All checks were successful
Build and Publish Docker Image / deploy (push) Successful in 1m38s
- Introduce APP_VERSION build argument and environment variable in Dockerfile. - Load AppVersion from environment variables in the configuration loader. - Pass the application version to the HTML renderer and expose it to templates via PageData. - Update tests to verify the version is correctly rendered in the footer.
44 lines
908 B
Docker
44 lines
908 B
Docker
FROM golang:1.26-alpine AS builder
|
|
|
|
WORKDIR /src/backend
|
|
|
|
COPY backend/go.mod backend/go.sum ./
|
|
RUN go mod download
|
|
|
|
COPY backend/ ./
|
|
|
|
ARG APP_VERSION=dev
|
|
RUN CGO_ENABLED=0 GOOS=linux go build \
|
|
-trimpath \
|
|
-ldflags="-s -w -X main.version=${APP_VERSION}" \
|
|
-o /out/warpbox \
|
|
./cmd/warpbox
|
|
|
|
FROM alpine:3.22
|
|
|
|
ARG APP_VERSION=dev
|
|
|
|
RUN apk add --no-cache ca-certificates ffmpeg wget
|
|
|
|
ENV WARPBOX_ADDR=:8080 \
|
|
WARPBOX_DATA_DIR=/data \
|
|
WARPBOX_STATIC_DIR=/app/static \
|
|
WARPBOX_TEMPLATE_DIR=/app/templates \
|
|
APP_VERSION=${APP_VERSION}
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /out/warpbox /usr/local/bin/warpbox
|
|
COPY backend/static /app/static
|
|
COPY backend/templates /app/templates
|
|
|
|
RUN mkdir -p /data
|
|
|
|
EXPOSE 8080
|
|
VOLUME ["/data"]
|
|
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
|
|
CMD wget -qO- http://127.0.0.1:8080/health >/dev/null || exit 1
|
|
|
|
ENTRYPOINT ["warpbox"]
|