Files
software-station/Dockerfile
Sudo-Ivan c9c74c778e Update Docker configuration and add metadata to Dockerfile
- Removed README.md and LICENSE from .dockerignore for inclusion in Docker image.
- Introduced a new docker-compose.yml file to define the application services and their configurations.
- Enhanced Dockerfile with build arguments and detailed image metadata for better documentation and version tracking.
2025-12-27 11:34:06 -06:00

67 lines
2.1 KiB
Docker

# Stage 1: Build the frontend
FROM cgr.dev/chainguard/node:latest-dev AS node-builder
WORKDIR /app
USER root
RUN npm install -g pnpm
USER node
COPY --chown=node:node frontend/package.json frontend/pnpm-lock.yaml ./frontend/
WORKDIR /app/frontend
RUN pnpm install --frozen-lockfile
COPY --chown=node:node frontend/ ./
RUN pnpm run build
# Stage 2: Build the Go binary with embedded assets
FROM cgr.dev/chainguard/go:latest-dev AS go-builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
COPY --from=node-builder /app/frontend/build ./frontend/build
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o software-station main.go
# Stage 3: Minimal runtime image
FROM cgr.dev/chainguard/wolfi-base:latest
WORKDIR /app
ARG BUILD_DATE
ARG VCS_REF
ARG VERSION="0.2.0"
LABEL org.opencontainers.image.created=$BUILD_DATE \
org.opencontainers.image.title="Software Station" \
org.opencontainers.image.description="A modern, high-performance software distribution platform for Gitea." \
org.opencontainers.image.url="https://quad4.io" \
org.opencontainers.image.documentation="https://github.com/Quad4-Software/software-station/blob/main/README.md" \
org.opencontainers.image.source="https://github.com/Quad4-Software/software-station" \
org.opencontainers.image.version=$VERSION \
org.opencontainers.image.revision=$VCS_REF \
org.opencontainers.image.vendor="Quad4" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.authors="Quad4" \
org.opencontainers.image.base.name="cgr.dev/chainguard/wolfi-base:latest"
RUN apk add --no-cache ca-certificates
COPY --from=go-builder /app/software-station .
COPY LICENSE README.md ./
COPY legal/ ./legal/
COPY software.txt /app/data/software.txt
COPY ua-blocklist.txt /app/data/ua-blocklist.txt
RUN mkdir -p /app/data /app/.cache && chown -R 65532:65532 /app/data /app/.cache
EXPOSE 8080
ENV PORT=8080
ENV NODE_ENV=production
ENV CONFIG_PATH=/app/data/software.txt
ENV UA_BLOCKLIST_PATH=/app/data/ua-blocklist.txt
USER 65532
CMD ["sh", "-c", "./software-station -c ${CONFIG_PATH} -ua-blocklist ${UA_BLOCKLIST_PATH}"]