Last active
January 24, 2021 15:18
-
-
Save pak11273/edfcc2d5b5f41e08a9cab2632a9087cb to your computer and use it in GitHub Desktop.
Dockerfile Server (Golang)
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
# 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