Files
walkies/Dockerfile
James Griffin 668397104a
All checks were successful
CI / Go tests & lint (push) Successful in 1m34s
CI / Frontend tests & type-check (push) Successful in 1m15s
Adopt @lavamoat/allow-scripts to gate npm install scripts
Disables dependency lifecycle scripts by default via .npmrc
(ignore-scripts=true) so arbitrary packages cannot execute code at
install time. An explicit allowlist in web/package.json opts specific
packages back in, and CI/Docker/Taskfile now run allow-scripts after
npm install to apply it.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-17 11:29:08 -03:00

26 lines
629 B
Docker

# Stage 1: Build React frontend
FROM node:22-alpine AS frontend
WORKDIR /app/web
COPY web/package*.json web/.npmrc ./
RUN npm install && npm exec -- allow-scripts
COPY web/ ./
RUN npm run build
# Stage 2: Build Go backend
FROM golang:1.26-alpine AS backend
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o /walkies ./cmd/server
# Stage 3: Final image
FROM alpine:3.21
RUN apk add --no-cache ca-certificates tzdata
WORKDIR /app
COPY --from=backend /walkies ./walkies
COPY --from=frontend /app/web/dist ./web/dist
EXPOSE 8080
ENV STATIC_DIR=/app/web/dist
CMD ["./walkies"]