Created
January 26, 2021 05:22
-
-
Save pak11273/27592c841b9bfcf2fb8d3b2a20a9f532 to your computer and use it in GitHub Desktop.
Dockerfile Web (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 port environment variable | |
ENV PORT=8080 | |
RUN mkdir /app | |
# adds the src directory from the host to the image | |
ADD ./web /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