-
Notifications
You must be signed in to change notification settings - Fork 10
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 build and release
- Loading branch information
1 parent
064c077
commit e3ce981
Showing
3 changed files
with
21 additions
and
12 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,14 +1,7 @@ | ||
FROM golang:1.22.5-bookworm as builder | ||
|
||
WORKDIR /sftp-exporter | ||
COPY ./go.mod ./ | ||
COPY ./go.sum ./ | ||
RUN go mod download -x | ||
COPY ./ ./ | ||
RUN GOOS=linux GOARCH=$(dpkg --print-architecture) make build | ||
|
||
FROM debian:bookworm | ||
|
||
WORKDIR /sftp-exporter | ||
COPY --from=builder /sftp-exporter/out/sftp-exporter . | ||
COPY ./sftp-exporter /usr/local/bin/ | ||
EXPOSE 8080 | ||
RUN useradd -ms /bin/bash sftp-exporter | ||
USER sftp-exporter | ||
ENTRYPOINT ["./sftp-exporter"] |
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,16 @@ | ||
FROM golang:1.22.5-bookworm as builder | ||
|
||
WORKDIR /sftp-exporter | ||
COPY ./go.mod ./ | ||
COPY ./go.sum ./ | ||
RUN go mod download -x | ||
COPY ./ ./ | ||
RUN GOOS=linux GOARCH=$(dpkg --print-architecture) make build | ||
|
||
FROM debian:bookworm | ||
|
||
COPY --from=builder /sftp-exporter/out/sftp-exporter /usr/local/bin/ | ||
EXPOSE 8080 | ||
RUN useradd -ms /bin/bash sftp-exporter | ||
USER sftp-exporter | ||
ENTRYPOINT ["sftp-exporter"] |
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