2024-05-11 20:23:05 +07:00
|
|
|
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
|
|
|
|
|
2024-05-13 10:54:39 +07:00
|
|
|
FROM devopsworks/golang-upx:1.22.1 AS builder
|
2024-05-11 20:23:05 +07:00
|
|
|
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
|
2024-05-13 11:11:54 +07:00
|
|
|
ARG REDMAGE_RUNTIME_VERSION=unknown
|
2024-05-13 10:54:39 +07:00
|
|
|
RUN --mount=type=cache,target=/root/.cache/go-build \
|
|
|
|
--mount=type=cache,target=/go/pkg/mod \
|
|
|
|
make build-docker && \
|
|
|
|
strip /app/redmage && \
|
|
|
|
/usr/local/bin/upx -9 /app/redmage
|
2024-05-11 20:23:05 +07:00
|
|
|
|
2024-05-12 11:56:20 +07:00
|
|
|
FROM gcr.io/distroless/base:latest
|
2024-05-11 20:23:05 +07:00
|
|
|
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" ]
|