-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (28 loc) · 964 Bytes
/
Dockerfile
File metadata and controls
39 lines (28 loc) · 964 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Stage 1: Build React frontend
FROM node:24-alpine3.22 AS frontend-builder
WORKDIR /build/ui
COPY ui/package*.json ./
RUN npm ci
COPY ui/ ./
RUN npm run build
# Stage 2: Build Go backend
FROM golang:1.25-alpine3.22 AS backend-builder
WORKDIR /build
COPY go.mod go.sum ./
ENV GOTOOLCHAIN=auto
RUN go mod download
COPY . .
ARG VERSION=dev
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-X 'github.com/chis/docksmith/internal/output.Version=${VERSION}'" -o docksmith ./cmd/docksmith
# Stage 3: Runtime
FROM alpine:3.23
RUN apk add --no-cache ca-certificates bash curl jq docker-cli docker-cli-compose
RUN mkdir -p /data
WORKDIR /app
COPY --from=backend-builder /build/docksmith /app/docksmith
COPY --from=frontend-builder /build/ui/dist /app/ui/dist
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8080/api/health || exit 1
ENTRYPOINT ["/app/docksmith"]
CMD ["api", "--port", "8080"]