projects

holonet

A multiplayer video game backend in Go

feat: add containerization

daniel daum committed parent 2604521 commit 3b951c1Signed, not verified

SignedGitea couldn't verify the signature.

Showing 4 changed files with 75 additions and 5 deletions.

.dockerignoreadded +41 −0
@@ -0,0 +1,41 @@1# Git2.git3.gitattributes45# Godot client (not needed in backend container)6clients/78# Docker9docker-compose.yaml10.dockerignore11Dockerfile12dockerfile1314# Editor15.vscode/16.idea/17*.swp1819# Documentation20*.md21LICENSE22docs/2324# Build output25bin/26out/2728# Environment (uncomment if you use .env files)29# .env30# .env.*3132# OS33.DS_Store34Thumbs.db3536# development37.air.toml38.gitea39.gitignore40mise.lock41mise.toml
docker-compose.yamladded +16 −0
@@ -0,0 +1,16 @@1name: holonet23services:4  holonet:5    build:6      context: .7      dockerfile: dockerfile8    image: holonet:latest9    container_name: holonet10    environment:11      HOST: "0.0.0.0"12      PORT: "7432"13      ENV: "production"14    ports:15      - "7432:7432"16    restart: unless-stopped
dockerfile +18 −5
@@ -1,12 +1,25 @@1FROM golang:1.27.11# ---- build ----2FROM golang:1.27.1-alpine AS build233WORKDIR /usr/src/app4WORKDIR /src455# pre-copy/cache go.mod for pre-downloading dependencies and only redownloading them in subsequent builds if they change6# dependencies first: editing Go source won't re-run this step67COPY go.mod go.sum ./78RUN go mod download89910COPY . .10RUN go build -v -o /usr/local/bin/app ./...11RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -o /out/holonet ./cmd/holonet111212CMD ["app"]13# ---- runtime ----14FROM alpine:3.241516# ca-certificates for outbound TLS, curl for poking at the service from inside17RUN apk add --no-cache ca-certificates curl \18    && adduser -D -u 65532 holonet1920COPY --from=build /out/holonet /usr/local/bin/holonet2122USER holonet23EXPOSE 74322425ENTRYPOINT ["holonet"]
go.sumadded +0 −0

No content changes.