refactor(docker): improve Docker setup and reduce image size

- Add multi-stage build to Dockerfile for smaller production image
- Move docker-compose.yml to project root for easier usage
- Flatten docker/init/setup.sh to docker/setup.sh
- Expand .dockerignore to exclude unnecessary files
- Remove deprecated version field from compose files
This commit is contained in:
Houmgaor
2026-02-01 23:49:52 +01:00
parent dc49e5c34a
commit 160130e464
5 changed files with 62 additions and 19 deletions

View File

@@ -1,4 +1,5 @@
FROM golang:1.25-alpine3.21
# Build stage
FROM golang:1.25-alpine3.21 AS builder
ENV GO111MODULE=on
@@ -11,4 +12,16 @@ RUN go mod download
COPY . .
CMD [ "go", "run", "." ]
RUN CGO_ENABLED=0 GOOS=linux go build -o erupe-ce .
# Runtime stage
FROM alpine:3.21
RUN apk --no-cache add ca-certificates tzdata
WORKDIR /app/erupe
COPY --from=builder /app/erupe/erupe-ce .
# Default command runs the compiled binary
CMD [ "./erupe-ce" ]