-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: build and publish an official container image (fix #2)
- Loading branch information
jantari
committed
Mar 26, 2023
1 parent
9309527
commit 0e0539c
Showing
4 changed files
with
63 additions
and
7 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
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
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,17 +1,28 @@ | ||
# builder image to compile the binary | ||
FROM golang:1.19.1 as builder | ||
# syntax=docker/dockerfile:1 | ||
|
||
# Builder image to compile the binary | ||
FROM golang:1.19 as builder | ||
|
||
WORKDIR $GOPATH/src/rewinged/rewinged/ | ||
COPY . . | ||
ENV CGO_ENABLED=0 | ||
RUN go build -o /tmp/rewinged | ||
RUN go build -o /tmp/rewinged -ldflags '-X "main.releaseMode=true"' | ||
|
||
|
||
|
||
# final image with nothing but the binary | ||
# Final image with nothing but the binary | ||
FROM scratch | ||
|
||
COPY --from=builder /tmp/rewinged /bin/rewinged | ||
COPY <<EOF /etc/passwd | ||
rewinged:x:10002:10002:rewinged:/:/rewinged | ||
EOF | ||
|
||
# WORKDIR creates directories if they don't exist; with 755 and owned by root | ||
WORKDIR /packages | ||
WORKDIR / | ||
|
||
COPY --from=builder /tmp/rewinged /rewinged | ||
|
||
ENTRYPOINT ["/bin/rewinged"] | ||
USER rewinged | ||
ENTRYPOINT ["/rewinged"] | ||
|
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,17 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
FROM scratch | ||
|
||
COPY <<EOF /etc/passwd | ||
rewinged:x:10002:10002:rewinged:/:/rewinged | ||
EOF | ||
|
||
# WORKDIR creates directories if they don't exist; with 755 and owned by root | ||
WORKDIR /packages | ||
WORKDIR / | ||
|
||
COPY rewinged /rewinged | ||
|
||
USER rewinged | ||
ENTRYPOINT ["/rewinged"] | ||
|