0
Fork 0
mirror of https://codeberg.org/SafeTwitch/safetwitch-backend.git synced 2024-12-22 13:13:00 -05:00

Merge pull request 'Add docker support' (#1) from go-backend into master

Reviewed-on: https://codeberg.org/dragongoose/safetwitch-backend/pulls/1
This commit is contained in:
dragongoose 2023-06-07 21:04:39 +00:00
commit 171857e8b4
2 changed files with 29 additions and 0 deletions

19
Dockerfile Normal file
View file

@ -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"]

10
docker-compose.yml Normal file
View file

@ -0,0 +1,10 @@
version: "3.9"
services:
backend:
build:
context: .
dockerfile: ./Dockerfile
ports:
- "7000:8080"
environment:
- URL=http://localhost:7000