feat: update dockerfiles and add .dockerignore
This commit is contained in:
6
backend/.dockerignore
Normal file
6
backend/.dockerignore
Normal file
@@ -0,0 +1,6 @@
|
||||
.git
|
||||
docker-compose.yml
|
||||
data/
|
||||
Makefile
|
||||
.env
|
||||
docs/
|
||||
@@ -3,18 +3,21 @@ FROM golang:1.25.6 AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
ENV CGO_ENABLED=0
|
||||
ENV GIN_MODE=release
|
||||
RUN go mod tidy
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
RUN go build -ldflags "-s -w" -o backend ./cmd/main.go
|
||||
|
||||
|
||||
FROM alpine:3.23.0
|
||||
|
||||
RUN adduser -D appuser && apk add --no-cache curl
|
||||
COPY --from=builder /app/backend .
|
||||
|
||||
RUN chown appuser:appuser ./backend
|
||||
USER appuser
|
||||
EXPOSE 8080
|
||||
RUN apk add --no-cache curl
|
||||
HEALTHCHECK CMD curl --fail http://localhost:8080/health || exit 1
|
||||
CMD ["./backend"]
|
||||
|
||||
Reference in New Issue
Block a user