Files
walkies/Dockerfile
James Griffin 8344bf016f
Some checks failed
CI / Go tests & lint (push) Successful in 9s
CI / Frontend tests & type-check (push) Failing after 14s
Move from Create React to Vite
2026-04-09 10:44:50 -03:00

26 lines
589 B
Docker

# Stage 1: Build React frontend
FROM node:22-alpine AS frontend
WORKDIR /app/web
COPY web/package*.json ./
RUN npm install
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"]