mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 07:32:32 +01:00
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:
17
Dockerfile
17
Dockerfile
@@ -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" ]
|
||||
|
||||
Reference in New Issue
Block a user