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