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
|
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
4
frontend/.dockerignore
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
Makefile
|
||||||
|
dist
|
||||||
|
node_modules
|
||||||
|
|
||||||
Reference in New Issue
Block a user