-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use separate dockerfile for building and running
- Loading branch information
Sebastian Gumprich
committed
Jul 27, 2023
1 parent
69a6304
commit 9414e01
Showing
2 changed files
with
30 additions
and
8 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,11 +1,22 @@ | ||
ARG DISTROLESS_IMAGE=gcr.io/distroless/base | ||
# syntax=docker/dockerfile:1 | ||
FROM golang:1.19-alpine AS build-env | ||
RUN mkdir -p /go/src/confluence-gardner | ||
|
||
# using base nonroot image | ||
# user:group is nobody:nobody, uid:gid = 65534:65534 | ||
FROM ${DISTROLESS_IMAGE} | ||
# Copy the module files first and then download the dependencies. If this | ||
# doesn't change, we won't need to do this again in future builds. | ||
WORKDIR /go/src/confluence-gardner | ||
|
||
# Copy our static executable | ||
COPY confluence-gardner /confluence-gardner | ||
COPY go.* ./ | ||
RUN go mod download | ||
|
||
# Run the hello binary. | ||
ENTRYPOINT ["/confluence-gardner"] | ||
WORKDIR /go/src/confluence-gardner | ||
ADD conf conf | ||
COPY *.go ./ | ||
RUN go build -o confluence-gardner | ||
|
||
# final stage | ||
FROM alpine:latest | ||
COPY --from=build-env /go/src/confluence-gardner/confluence-gardner /usr/local/bin/confluence-gardner | ||
RUN mkdir -p /output | ||
ENV DIRECTORY /output | ||
ENTRYPOINT ["confluence-gardner"] |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
ARG DISTROLESS_IMAGE=gcr.io/distroless/base | ||
|
||
# using base nonroot image | ||
# user:group is nobody:nobody, uid:gid = 65534:65534 | ||
FROM ${DISTROLESS_IMAGE} | ||
|
||
# Copy our static executable | ||
COPY confluence-gardner /confluence-gardner | ||
|
||
# Run the hello binary. | ||
ENTRYPOINT ["/confluence-gardner"] |