-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathContainerfile
More file actions
37 lines (27 loc) · 1.23 KB
/
Containerfile
File metadata and controls
37 lines (27 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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 GODEBUG=fips140=on GOFIPS140=v1.0.0 GO111MODULE=on CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o ./out/trawler -ldflags="-X 'main.Version=$(git describe --tags)' -X 'main.BuildTime=$(date +%Y%m%dT%H%M)'" .
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
WORKDIR /app/
CMD ["/app/trawler"]