forked from RedHatInsights/edge-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
42 lines (34 loc) · 1.36 KB
/
Dockerfile
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
############################
# STEP 1 build executable binary
############################
FROM registry.redhat.io/rhel8/go-toolset:1.15 AS builder
WORKDIR $GOPATH/src/mypackage/myapp/
COPY . .
# Use go mod
ENV GO111MODULE=on
# Fetch dependencies.
# Using go get requires root.
USER root
RUN go get -d -v
# Build the binary.
RUN CGO_ENABLED=0 go build -o /go/bin/edge-api
# Build the migration binary.
RUN CGO_ENABLED=0 go build -o /go/bin/edge-api-migrate cmd/migrate/migrate.go
############################
# STEP 2 build a small image
############################
FROM registry.redhat.io/ubi8-minimal:latest
#FROM quay.io/loadtheaccumulator/ubi8-isotools:latest
COPY --from=builder /go/bin/edge-api /usr/bin
COPY --from=builder /go/bin/edge-api-migrate /usr/bin
COPY --from=builder /src/mypackage/myapp/cmd/spec/openapi.json /var/tmp
# kickstart inject requirements
COPY --from=builder /src/mypackage/myapp/pkg/images/fleetkick.sh /usr/local/bin
RUN chmod +x /usr/local/bin/fleetkick.sh
COPY --from=builder /src/mypackage/myapp/pkg/images/templateKickstart.ks /usr/local/etc
# template to playbook dispatcher
COPY --from=builder /src/mypackage/myapp/pkg/playbooks/template_playbook_dispatcher_ostree_upgrade_payload.yml /usr/local/etc
RUN microdnf install -y pykickstart mtools xorriso genisoimage syslinux isomd5sum file ostree
ENV MTOOLS_SKIP_CHECK=1
USER 1001
CMD ["edge-api"]