Skip to content

Instantly share code, notes, and snippets.

@thatisuday
Last active August 1, 2023 07:37
Show Gist options
  • Save thatisuday/a77e6a2c21138696573052493b6a6ad1 to your computer and use it in GitHub Desktop.
Save thatisuday/a77e6a2c21138696573052493b6a6ad1 to your computer and use it in GitHub Desktop.
A sample Dockerfile to create Go image
# 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