- Added a new parameter to the SecurityMiddleware function to allow custom handling of forbidden requests. - Updated Docker configurations to enable asset caching for improved performance. - Bumped version number in the Dockerfile to 0.3.0 and refined the image description for clarity. - Adjusted various frontend components and error handling to support new rate limiting and forbidden access messages. - Improved documentation in multiple languages to reflect recent changes in features and security measures.
67 lines
2.3 KiB
Docker
67 lines
2.3 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/
|
|
RUN --mount=type=cache,target=/home/node/.pnpm-store \
|
|
cd frontend && pnpm install --frozen-lockfile
|
|
|
|
COPY --chown=node:node frontend/ ./frontend/
|
|
RUN cd frontend && 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 --mount=type=cache,target=/go/pkg/mod \
|
|
go mod download
|
|
COPY . .
|
|
COPY --from=node-builder /app/frontend/build ./frontend/build
|
|
RUN --mount=type=cache,target=/root/.cache/go-build \
|
|
CGO_ENABLED=0 go build -ldflags="-s -w" -o software-station main.go
|
|
|
|
RUN mkdir -p /app/data /app/.cache && chown 65532:65532 /app/data /app/.cache
|
|
|
|
# Stage 3: Minimal runtime image
|
|
FROM cgr.dev/chainguard/static:latest
|
|
WORKDIR /app
|
|
|
|
ARG BUILD_DATE
|
|
ARG VCS_REF
|
|
ARG VERSION="0.3.0"
|
|
|
|
LABEL org.opencontainers.image.created=$BUILD_DATE \
|
|
org.opencontainers.image.title="Software Station" \
|
|
org.opencontainers.image.description="A secure software distribution platform." \
|
|
org.opencontainers.image.url="https://quad4.io" \
|
|
org.opencontainers.image.documentation="https://git.quad4.io/Quad4-Software/software-station/src/branch/master/frontend/src/lib/docs" \
|
|
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/static:latest"
|
|
|
|
COPY --from=go-builder /app/software-station .
|
|
COPY --from=go-builder --chown=65532:65532 /app/data ./data
|
|
COPY --from=go-builder --chown=65532:65532 /app/.cache ./.cache
|
|
COPY LICENSE README.md ./
|
|
COPY legal/ ./legal/
|
|
COPY software.txt /app/data/software.txt
|
|
COPY ua-blocklist.txt /app/data/ua-blocklist.txt
|
|
|
|
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 ["./software-station"]
|