From 5ed7d3d2f4c854d1c33111f04488e62b95077060 Mon Sep 17 00:00:00 2001 From: dragongoose Date: Wed, 7 Jun 2023 17:00:58 -0400 Subject: [PATCH] Add docker support --- Dockerfile | 19 +++++++++++++++++++ docker-compose.yml | 10 ++++++++++ 2 files changed, 29 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e02a9d8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM golang:1.20.3 as builder + +# Create and change to the app directory. +WORKDIR /app +COPY go.* ./ +RUN go mod download + +COPY . ./ + +RUN CGO_ENABLED=0 GOOS=linux go build -mod=readonly -v -o server + +FROM alpine:3 +RUN apk add --no-cache ca-certificates + +COPY --from=builder /app/server /server +ENV PORT=8080 +EXPOSE 8080 + +ENTRYPOINT ["/server"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a801c0b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +version: "3.9" +services: + backend: + build: + context: . + dockerfile: ./Dockerfile + ports: + - "7000:8080" + environment: + - URL=http://localhost:7000 \ No newline at end of file