Skip to content

Instantly share code, notes, and snippets.

@pak11273
Created January 26, 2021 05:22
Show Gist options
  • Save pak11273/27592c841b9bfcf2fb8d3b2a20a9f532 to your computer and use it in GitHub Desktop.
Save pak11273/27592c841b9bfcf2fb8d3b2a20a9f532 to your computer and use it in GitHub Desktop.
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