feat: update dockerfiles and add .dockerignore

This commit is contained in:
d3m0k1d
2026-02-28 23:05:29 +03:00
parent bb987b1f8b
commit 9094f5e278
3 changed files with 18 additions and 5 deletions

6
backend/.dockerignore Normal file
View File

@@ -0,0 +1,6 @@
.git
docker-compose.yml
data/
Makefile
.env
docs/

View File

@@ -3,18 +3,21 @@ FROM golang:1.25.6 AS builder
WORKDIR /app WORKDIR /app
COPY . .
ENV CGO_ENABLED=0 ENV CGO_ENABLED=0
ENV GIN_MODE=release 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 RUN go build -ldflags "-s -w" -o backend ./cmd/main.go
FROM alpine:3.23.0 FROM alpine:3.23.0
RUN adduser -D appuser && apk add --no-cache curl
COPY --from=builder /app/backend . COPY --from=builder /app/backend .
RUN chown appuser:appuser ./backend
USER appuser
EXPOSE 8080 EXPOSE 8080
RUN apk add --no-cache curl
HEALTHCHECK CMD curl --fail http://localhost:8080/health || exit 1 HEALTHCHECK CMD curl --fail http://localhost:8080/health || exit 1
CMD ["./backend"] CMD ["./backend"]

4
frontend/.dockerignore Normal file
View File

@@ -0,0 +1,4 @@
Makefile
dist
node_modules