Redmage/Dockerfile

31 lines
816 B
Docker

FROM node:22-bullseye AS web-builder
WORKDIR /web
COPY package.json package-lock.json ./
RUN npm install
COPY Makefile ./
COPY views ./views
COPY tailwind.config.js ./
RUN make web-build
FROM golang:1.22.1 AS builder
WORKDIR /app
COPY Makefile ./
RUN make build-dependencies
COPY go.mod go.sum ./
RUN go mod download
COPY . .
COPY --from=web-builder /web/public ./public
ENV REDMAGE_RUNTIME_VERSION=unknown
RUN --mount=type=cache,target=/root/.cache/go-build make build-docker
FROM gcr.io/distroless/base:nonroot
WORKDIR /app
COPY --from=builder /app/redmage /app/redmage
ENV REDMAGE_FLAGS_CONTAINERIZED=true
ENV REDMAGE_DB_STRING=/app/db/data.db
ENV REDMAGE_PUBSUB_DB_NAME=/app/db/pubsub.db
ENV REDMAGE_DOWNLOAD_DIRECTORY=/app/downloads
ENV REDMAGE_RUNTIME_ENVIRONMENT=production
CMD [ "/app/redmage", "serve" ]