38 lines
1.4 KiB
Docker
38 lines
1.4 KiB
Docker
FROM node:24.22.2-bookworm-slim AS frontend-build
|
|
WORKDIR /src/frontend
|
|
COPY frontend/package.json frontend/package-lock.json ./
|
|
RUN npm ci
|
|
COPY frontend/ ./
|
|
RUN npm run build
|
|
|
|
FROM golang:1.26.1-bookworm AS backend-build
|
|
WORKDIR /src
|
|
ENV CGO_ENABLED=1
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY webserver.go ./
|
|
COPY backend/ ./backend/
|
|
COPY cli/ ./cli/
|
|
COPY config/ ./config/
|
|
COPY frontend/frontend.go ./frontend/frontend.go
|
|
COPY frontend/handlers/ ./frontend/handlers/
|
|
COPY utils/ ./utils/
|
|
RUN go test -p 1 -trimpath ./... && go build -p 1 -trimpath -o /out/webserver .
|
|
|
|
FROM debian:bookworm-slim
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends ca-certificates curl tzdata \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
WORKDIR /app
|
|
COPY --from=backend-build /out/webserver ./webserver
|
|
COPY --from=frontend-build /src/frontend/dist ./frontend/dist
|
|
COPY backend/templates/ ./backend/templates/
|
|
RUN install -d -o 10001 -g 10001 /app/backend/data /app/logs
|
|
ENV AUTOLIBRARY_HTTP_PORT=3000
|
|
USER 10001:10001
|
|
HEALTHCHECK --interval=10s --timeout=5s --start-period=15s --retries=3 \
|
|
CMD curl -fsS --noproxy '*' --max-time 2 -o /dev/null "http://127.0.0.1:${AUTOLIBRARY_HTTP_PORT}/" \
|
|
&& curl -fsS --noproxy '*' --max-time 2 -o /dev/null "http://127.0.0.1:${AUTOLIBRARY_HTTP_PORT}/api/health"
|
|
ENTRYPOINT ["/app/webserver"]
|
|
CMD ["start", "--config", "/app/config.json"]
|