Skip to content

Commit a59bdf9

Browse files
fix: update Containerfile for golang
1 parent 6882f2a commit a59bdf9

File tree

1 file changed

+36
-10
lines changed

1 file changed

+36
-10
lines changed

Containerfile

+36-10
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,37 @@
11
FROM registry.access.redhat.com/ubi8/ubi-minimal
2-
RUN microdnf install -y python38 python38-devel redhat-rpm-config gcc libffi-devel openssl-devel cargo
3-
WORKDIR /app
4-
COPY ./requirements.txt /app/requirements.txt
5-
RUN python3 -m pip install setuptools_rust
6-
RUN python3 -m pip install -r /app/requirements.txt
7-
COPY *.py /app/
8-
COPY test-assets /app/test-assets
9-
USER 1000
10-
EXPOSE 8080
11-
CMD ["python3", "/app/trawler.py", "-c", "/app/config/config.yaml"]
2+
RUN microdnf update -y --refresh --best --nodocs --noplugins --setopt=install_weak_deps=0 && \
3+
microdnf install -y --refresh --best --nodocs --noplugins --setopt=install_weak_deps=0 zip unzip make git gcc && \
4+
microdnf install -y --refresh --best --nodocs --noplugins --setopt=install_weak_deps=0 go-toolset ca-certificates && \
5+
microdnf clean all && \
6+
rm -rf /var/cache/yum
7+
8+
ENV GOPATH /tmp/go
9+
ENV PATH $PATH:$GOPATH/bin
10+
11+
COPY . .
12+
RUN go mod download
13+
14+
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./out/trawler .
15+
16+
FROM registry.access.redhat.com/ubi9/ubi-minimal
17+
18+
ARG USER_UID
19+
ARG USER_NAME
20+
21+
ENV USER_UID ${USER_UID:-1001}
22+
ENV USER_NAME ${USER_NAME:-apic}
23+
RUN mkdir -p ${HOME} && chown ${USER_UID}:0 ${HOME} && chmod ug+rwx ${HOME}
24+
25+
COPY --from=build /app/out/trawler /app/trawler
26+
COPY base-config.yaml /app/config/config.yaml
27+
28+
USER root
29+
RUN microdnf upgrade -y --refresh --best --nodocs --noplugins --setopt=install_weak_deps=0 \
30+
&& microdnf clean all
31+
USER 1001:0
32+
33+
EXPOSE 63512
34+
ENV CONFIG_PATH=/app/config/config.yaml
35+
36+
CMD ["/app/trawler"]
37+

0 commit comments

Comments
 (0)