From 1015db626c326737eeb3e4acde3d570f10b8bbf2 Mon Sep 17 00:00:00 2001 From: Supan Adit Pratama Date: Sat, 10 Sep 2022 13:46:30 +0700 Subject: [PATCH] experiment with dockerfile --- Dockerfile | 24 ++++++++++++++++++++++++ system/constants.go | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ee5eca7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM golang:1.18-alpine + +RUN apk add --no-cache git + +# Set the Current Working Directory inside the container +WORKDIR /app/geosmart + +# We want to populate the module cache based on the go.{mod,sum} files. +COPY go.mod . +COPY go.sum . + +RUN go mod download + +COPY . . + +# Build the Go app +RUN go build -o ./build/geosmart . + + +# This container exposes port 8080 to the outside world +EXPOSE 8080 + +# Run the binary program produced by `go install` +CMD ["./build/geosmart"] \ No newline at end of file diff --git a/system/constants.go b/system/constants.go index c8d7f76..edb5c20 100644 --- a/system/constants.go +++ b/system/constants.go @@ -4,7 +4,7 @@ import "fmt" const ( // Tile 38 - Tile38Address = "127.0.0.1" + Tile38Address = "tile38_database" Tile38Port = "9851" // Server Port ServerPort = "8080"