-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 🐳 Add docker support * ♻️ Add user and use ARG in Dockerfile * ♻️ Use build in PR workflow * ♻️ Handle config arg for make cmds
- Loading branch information
Showing
6 changed files
with
65 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,6 @@ | |
|
||
# Go workspace file | ||
go.work | ||
|
||
# Folders | ||
/bin/ |
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,26 @@ | ||
ARG GOLANG_VERSION=1 | ||
# Pull golang alpine to build binary | ||
FROM golang:${GOLANG_VERSION}-alpine as builder | ||
|
||
RUN apk add --no-cache make | ||
|
||
WORKDIR /app | ||
|
||
# Build binary | ||
COPY . . | ||
RUN make build | ||
|
||
# Use alpine to run app | ||
FROM alpine | ||
RUN adduser -D onchain && \ | ||
mkdir /home/onchain/faultdetector && \ | ||
chown -R onchain:onchain /home/onchain/ | ||
USER onchain | ||
WORKDIR /home/onchain/faultdetector | ||
COPY --from=builder /app/bin/faultdetector ./bin/ | ||
COPY --from=builder /app/config.yaml . | ||
|
||
EXPOSE 8080 | ||
|
||
# Run app | ||
CMD [ "./bin/faultdetector" ] |
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