Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Dockerfile Web (Golang)
# 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