Skip to content

Commit 58266ee

Browse files
Chad Shawclaude
andcommitted
Fix dockerfile build error by updating to proper multi-stage build
- Replace broken wget download approach with proper Go build process - Use multi-stage build pattern matching main Dockerfile - Fix incorrect URL reference that was causing 404 errors in CI/CD - Ensure consistent build process across both dockerfile variants 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 8119cd5 commit 58266ee

File tree

1 file changed

+47
-8
lines changed

1 file changed

+47
-8
lines changed

dockerfile

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,55 @@
1+
# Build stage
2+
FROM golang:1.23.4-alpine AS builder
3+
4+
WORKDIR /build
5+
6+
# Install build dependencies
7+
RUN apk add --no-cache git
8+
9+
# Copy go mod files
10+
COPY go.mod go.sum ./
11+
RUN go mod download
12+
13+
# Copy source code
14+
COPY . .
15+
16+
# Build the application
17+
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o ignite .
18+
19+
# Production stage
120
FROM alpine:latest
2-
ENV DB_PATH=./
21+
22+
# Install runtime dependencies
23+
RUN apk --no-cache add ca-certificates curl && \
24+
addgroup -g 1001 ignite && \
25+
adduser -D -s /bin/sh -u 1001 -G ignite ignite
26+
27+
# Set environment variables
28+
ENV DB_PATH=/app/data/
329
ENV DB_FILE=ignite.db
430
ENV DB_BUCKET=dhcp
531
ENV BIOS_FILE=boot-bios/pxelinux.0
632
ENV EFI_FILE=boot-efi/syslinux.efi
7-
ENV TFTP_DIR=./public/tftp
8-
ENV HTTP_DIR=./public/http
33+
ENV TFTP_DIR=/app/public/tftp
34+
ENV HTTP_DIR=/app/public/http
935
ENV HTTP_PORT=8080
10-
ENV PROV_DIR=./public/provision
36+
ENV PROV_DIR=/app/public/provision
37+
1138
WORKDIR /app
12-
RUN wget -O ./app https://github.com/chadleeshaw/ignite/releases/download/v2.0/app && \
13-
chmod +x ./app
14-
COPY ./public /app/public
39+
40+
# Copy binary from builder stage
41+
COPY --from=builder /build/ignite .
42+
COPY --chown=ignite:ignite ./public ./public
43+
44+
# Create data directory for database
45+
RUN mkdir -p /app/data && chown ignite:ignite /app/data
46+
47+
# Switch to non-root user
48+
USER ignite
49+
1550
EXPOSE 8080
16-
CMD ["./ignite"]
51+
52+
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
53+
CMD curl -f http://localhost:8080/status || exit 1
54+
55+
CMD ["./ignite"]

0 commit comments

Comments
 (0)