-
Notifications
You must be signed in to change notification settings - Fork 44
/
Dockerfile.image-service
53 lines (41 loc) · 1.59 KB
/
Dockerfile.image-service
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
FROM registry.access.redhat.com/ubi9/go-toolset:1.21 AS golang
USER 0
## Build
COPY go.mod go.mod
COPY go.sum go.sum
RUN go mod download
ADD . /app
WORKDIR /app
RUN CGO_ENABLED=1 GOFLAGS="" GO111MODULE=on go build -o /assisted-image-service main.go
## Licenses
RUN go install github.com/google/go-licenses@v1.6.0
RUN ${HOME}/go/bin/go-licenses save --save_path /tmp/licenses ./...
## Runtime
FROM quay.io/centos/centos:stream9
ARG release=main
ARG version=latest
LABEL com.redhat.component assisted-image-service
LABEL description "Provide RHCOS image customization and serving for assisted-installer"
LABEL summary "Provide RHCOS image customization and serving for assisted-installer"
LABEL io.k8s.description "Provide RHCOS image customization and serving for assisted-installer"
LABEL distribution-scope public
LABEL name assisted-image-service
LABEL release ${release}
LABEL version ${version}
LABEL url https://github.com/openshift/assisted-image-service
LABEL vendor "Red Hat, Inc."
LABEL maintainer "Red Hat"
# Ensure UID can write in data dir (e.g.: when using podman, docker, ...)
# Ensure root group can write in data dir when deployed on OCP
# https://docs.openshift.com/container-platform/4.16/openshift_images/create-images.html#use-uid_create-images
ARG DATA_DIR=/data
ARG UID=1001
ARG GID=0
RUN mkdir $DATA_DIR && chmod 775 $DATA_DIR && chown $UID:$GID /data
VOLUME $DATA_DIR
ENV DATA_DIR=$DATA_DIR
RUN dnf install -y nmstate && dnf clean all
USER $UID:$GID
COPY --from=golang /tmp/licenses /licenses
COPY --from=golang /assisted-image-service /assisted-image-service
CMD ["/assisted-image-service"]