Skip to content

Instantly share code, notes, and snippets.

@pak11273
Last active January 24, 2021 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pak11273/edfcc2d5b5f41e08a9cab2632a9087cb to your computer and use it in GitHub Desktop.
Save pak11273/edfcc2d5b5f41e08a9cab2632a9087cb to your computer and use it in GitHub Desktop.
Dockerfile Server (Golang)
# indicates the base image to use which is golang
FROM golang:1.15-alpine3.12
# sets the GIN_MODE environment variable
ENV GIN_MODE=release
# sets the port environment variable
ENV PORT=3004
RUN mkdir /app
# adds the src directory from the host to the image
ADD ./server /app
# sets the container working directory
WORKDIR /app
# this builds the application.
RUN go build -o main .
# this runs the main function
CMD [ "/app/main" ]
## THIS SECTION IS IF YOU IMPLEMENT GITHUB ACTIONS IN YOUR APP
# This installs git in the environment as git is required to pull go dependencies
# RUN apk update && apk add --no-cache git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment