UNCLASSIFIED - NO CUI

Skip to content
Snippets Groups Projects

update dockerfile to use pipeline build artifact

Merged abrichards requested to merge dev-fix-dockerfile into master
1 file
+ 1
25
Compare changes
  • Side-by-side
  • Inline
+ 1
25
# NOTE: USING THIS IMAGE UNTIL registry1 credentials are added to IL2 runners
# Build the manager binary
FROM registry.il2.dso.mil/platform-one/devops/pipeline-templates/valkyrie/golang-builder-1.16:1.1 as builder
# note: Adam tried to use GOMODCACHE env variable to pull in go cache
# it worked locally but not with buildah.
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.sum ./
COPY main.go main.go driver.go driver.go ./
COPY apis/ apis/
COPY config/ config/
COPY custom/ custom/
COPY resources/ resources/
COPY controllers/ controllers/
COPY clients/ clients/
# RUN chmod 755 go.sum
# download with json logging
# RUN go mod download -json
RUN go mod download
# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go driver.go
# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM registry.il2.dso.mil/platform-one/devops/pipeline-templates/valkyrie/harden-valkyrie-python39:1.0
WORKDIR /app
COPY --from=builder /workspace/manager .
COPY --from=builder /workspace/resources resources
COPY .gobuild/bin/ .
USER appuser
# run interactively `docker run -it --entrypoint bash IMAGE_NAME`
Loading