-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added dockerfile #55
base: main
Are you sure you want to change the base?
added dockerfile #55
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# build stage | ||
## import image | ||
FROM golang:alpine AS build_base | ||
|
||
## add git | ||
RUN apk add --no-cache git | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you need |
||
|
||
## cd into global 700 dir (image specific) | ||
WORKDIR /go | ||
|
||
## populate the module cache based on the go.{mod,sum} files. | ||
COPY go.mod . | ||
COPY go.sum . | ||
## download the modules | ||
RUN go mod download | ||
|
||
## copy all files into build stage | ||
COPY . . | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you explicitly |
||
## BUILD BUILD BUILD! | ||
RUN go build -o ./out/gosh . | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe do a static build through |
||
|
||
|
||
# run stage | ||
## import image | ||
FROM alpine:latest | ||
## install certificates | ||
RUN apk add ca-certificates | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you need the |
||
|
||
## copy app from build stage to run stage | ||
COPY --from=build_base /go/out/gosh /app/gosh | ||
|
||
## copy files from build stage to run stage | ||
COPY --from=build_base /go/* /app | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why? The single |
||
|
||
## expose port | ||
EXPOSE 8080 | ||
## run app | ||
CMD ["/app/gosh", "-config", "/app/gosh.yml"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case, gosh would be run as the root user, but no other users where added. Thus, gosh cannot drop privileges to another user and would be executed as root. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for providing a Docker image! However, the tagged version 0.6.0 is kinda outdated and lots have changed in the meantime, which I haven't completed into its own release, yet.
Maybe add a your username next to it, so that people are able to ping you for updates? Otherwise, this image should be built automatically through the CI.