Last active
August 1, 2023 07:37
-
-
Save thatisuday/a77e6a2c21138696573052493b6a6ad1 to your computer and use it in GitHub Desktop.
A sample Dockerfile to create Go image
This file contains hidden or 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
# parent image | |
FROM golang:1.15.6-alpine3.12 | |
# workspace directory | |
WORKDIR /app | |
# copy `go.mod` and `go.sum` | |
ADD go.mod go.sum ./ | |
# install dependencies | |
RUN go mod download | |
# copy source code | |
COPY . . | |
# build executable | |
RUN go build -o ./bin/avatar . | |
# create volume | |
VOLUME [ "/app/shared" ] | |
# set entrypoint | |
ENTRYPOINT [ "./bin/avatar" ] | |
# set default arguments | |
CMD [ "./test.jpg", "./shared/test_out.jpg" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment