-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ricky Moorhouse <[email protected]>
- Loading branch information
1 parent
6ae6338
commit 64369c0
Showing
1 changed file
with
37 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,37 @@ | ||
FROM registry.access.redhat.com/ubi8/ubi-minimal | ||
RUN microdnf install -y python3 python3-devel redhat-rpm-config gcc libffi-devel openssl-devel cargo | ||
WORKDIR /app | ||
COPY ./requirements.txt /app/ | ||
RUN python3 -m pip install setuptools_rust | ||
RUN python3 -m pip install -r /app/requirements.txt | ||
COPY *.py /app/ | ||
COPY test-assets /app/test-assets | ||
# Create and set user | ||
RUN adduser -D trawler -u 1000 | ||
RUN chown -R trawler:users /app | ||
USER 1000 | ||
ENV APP_FILE=/app/trawler.py | ||
CMD ["python3", "/app/trawler.py", "-c", "/app/config/config.yaml"] | ||
FROM registry.access.redhat.com/ubi9/ubi-minimal AS build | ||
RUN microdnf update -y --refresh --best --nodocs --noplugins --setopt=install_weak_deps=0 && \ | ||
microdnf install -y --refresh --best --nodocs --noplugins --setopt=install_weak_deps=0 zip unzip make git gcc && \ | ||
microdnf install -y --refresh --best --nodocs --noplugins --setopt=install_weak_deps=0 go-toolset ca-certificates && \ | ||
microdnf clean all && \ | ||
rm -rf /var/cache/yum | ||
WORKDIR /app/ | ||
|
||
ENV GOPATH /tmp/go | ||
ENV PATH $PATH:$GOPATH/bin | ||
|
||
COPY . . | ||
RUN go mod download | ||
|
||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./out/trawler . | ||
|
||
FROM registry.access.redhat.com/ubi9/ubi-minimal | ||
|
||
ARG USER_UID | ||
ARG USER_NAME | ||
|
||
ENV USER_UID ${USER_UID:-1001} | ||
ENV USER_NAME ${USER_NAME:-apic} | ||
RUN mkdir -p ${HOME} && chown ${USER_UID}:0 ${HOME} && chmod ug+rwx ${HOME} | ||
|
||
COPY --from=build /app/out/trawler /app/trawler | ||
COPY base-config.yaml /app/config/config.yaml | ||
|
||
USER root | ||
RUN microdnf upgrade -y --refresh --best --nodocs --noplugins --setopt=install_weak_deps=0 \ | ||
&& microdnf clean all | ||
USER 1001:0 | ||
|
||
EXPOSE 63512 | ||
ENV CONFIG_PATH=/app/config/config.yaml | ||
|
||
CMD ["/app/trawler"] |