Last active
November 17, 2021 05:45
-
-
Save andressamachado/0497d6fceaf341316f8afb32320f65d0 to your computer and use it in GitHub Desktop.
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
# syntax=docker/dockerfile:1 | |
# Defining the base image layer from which the container will be build, in our case golang as we are using Go to setup the server. | |
# I got image from Docker hub Official Images webpage. https://hub.docker.com/_/golang | |
FROM golang:1.16.10-alpine | |
# Default port value | |
ARG GO_SERVER_PORT=3030 | |
# Creating a default directory to live inside the container | |
WORKDIR /go-web-server | |
# Copying root dependencies file provided (module) into the app directory within the image | |
COPY go.mod ./ | |
RUN go mod download | |
# Copying our source code into the app directory within the image and build it | |
COPY main.go ./ | |
RUN go build -o /go-web-server | |
EXPOSE ${GO_SERVER_PORT} | |
CMD [ "/go-web-server/go-web-server" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Kim!
I wrote some comments to show my thoughts during the process. I did not know if I should write them as I saw on the directions to write the Dockerfile as if the container would be used in production. Hope it is okay :)