mirror of
https://github.com/kjanat/articulate-parser.git
synced 2026-01-16 12:22:08 +01:00
Bumps the docker-images group with 1 update: golang. Updates `golang` from 1.23-alpine to 1.24-alpine --- updated-dependencies: - dependency-name: golang dependency-version: 1.24-alpine dependency-type: direct:production dependency-group: docker-images ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
79 lines
2.4 KiB
Docker
79 lines
2.4 KiB
Docker
# Development Dockerfile with shell access
|
|
# Uses Alpine instead of scratch for debugging
|
|
|
|
# Build stage - same as production
|
|
FROM golang:1.24-alpine AS builder
|
|
|
|
# Install git and ca-certificates (needed for fetching dependencies and HTTPS)
|
|
RUN apk add --no-cache git ca-certificates tzdata file
|
|
|
|
# Create a non-root user
|
|
RUN adduser -D -u 1000 appuser
|
|
|
|
# Set the working directory
|
|
WORKDIR /app
|
|
|
|
# Copy go mod files
|
|
COPY go.mod go.sum ./
|
|
|
|
# Download dependencies
|
|
RUN go mod download
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build the application
|
|
# Disable CGO for a fully static binary
|
|
# Use linker flags to reduce binary size and embed version info
|
|
ARG VERSION=dev
|
|
ARG BUILD_TIME
|
|
ARG GIT_COMMIT
|
|
# Docker buildx automatically provides these for multi-platform builds
|
|
ARG BUILDPLATFORM
|
|
ARG TARGETPLATFORM
|
|
ARG TARGETOS
|
|
ARG TARGETARCH
|
|
ARG TARGETVARIANT
|
|
|
|
# Debug: Show build information
|
|
RUN echo "Building for platform: $TARGETPLATFORM (OS: $TARGETOS, Arch: $TARGETARCH, Variant: $TARGETVARIANT)" \
|
|
&& echo "Build platform: $BUILDPLATFORM" \
|
|
&& echo "Go version: $(go version)"
|
|
|
|
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build \
|
|
-ldflags="-s -w -X github.com/kjanat/articulate-parser/internal/version.Version=${VERSION} -X github.com/kjanat/articulate-parser/internal/version.BuildTime=${BUILD_TIME} -X github.com/kjanat/articulate-parser/internal/version.GitCommit=${GIT_COMMIT}" \
|
|
-o articulate-parser \
|
|
./main.go
|
|
|
|
# Verify the binary architecture
|
|
RUN file /app/articulate-parser || echo "file command not available"
|
|
|
|
# Development stage - uses Alpine for shell access
|
|
FROM alpine:3.21.3
|
|
|
|
# Install minimal dependencies
|
|
RUN apk add --no-cache ca-certificates tzdata
|
|
|
|
# Copy the binary
|
|
COPY --from=builder /app/articulate-parser /articulate-parser
|
|
|
|
# Copy the non-root user configuration
|
|
COPY --from=builder /etc/passwd /etc/passwd
|
|
|
|
# Switch to non-root user
|
|
USER appuser
|
|
|
|
# Set the binary as entrypoint
|
|
ENTRYPOINT ["/articulate-parser"]
|
|
|
|
# Default command shows help
|
|
CMD ["--help"]
|
|
|
|
# Add labels for metadata
|
|
LABEL org.opencontainers.image.title="Articulate Parser (Dev)"
|
|
LABEL org.opencontainers.image.description="Development version of Articulate Parser with shell access"
|
|
LABEL org.opencontainers.image.vendor="kjanat"
|
|
LABEL org.opencontainers.image.licenses="MIT"
|
|
LABEL org.opencontainers.image.source="https://github.com/kjanat/articulate-parser"
|
|
LABEL org.opencontainers.image.documentation="https://github.com/kjanat/articulate-parser/blob/master/DOCKER.md"
|