v0.1.2: Add VERSION.txt with build-time injection
This commit is contained in:
10
Dockerfile
10
Dockerfile
@@ -1,5 +1,9 @@
|
||||
# Multi-stage build: Backend + Frontend
|
||||
FROM alpine:latest AS version
|
||||
COPY VERSION.txt /tmp/version.txt
|
||||
|
||||
FROM oven/bun:1.1-alpine AS backend-builder
|
||||
COPY --from=version /tmp/version.txt /tmp/version.txt
|
||||
|
||||
WORKDIR /app/backend
|
||||
COPY backend/package*.json ./
|
||||
@@ -7,11 +11,13 @@ RUN bun install
|
||||
COPY backend/prisma ./prisma
|
||||
RUN bunx prisma generate
|
||||
COPY backend/src ./src
|
||||
RUN bun build src/index.ts --outdir ./dist --target bun
|
||||
COPY backend/package.json ./
|
||||
RUN sed -i "s/{{VERSION}}/$(cat /tmp/version.txt)/g" src/index.ts && sed -i "s/{{VERSION}}/$(cat /tmp/version.txt)/g" package.json && bun build src/index.ts --outdir ./dist --target bun
|
||||
|
||||
FROM node:20-alpine AS frontend-builder
|
||||
ARG VITE_GIT_URL=https://git.kropa.tech/lotherk/deardiary
|
||||
ARG VITE_WEBSITE_URL=https://deardiary.lother.io
|
||||
COPY --from=backend-builder /tmp/version.txt /tmp/version.txt
|
||||
|
||||
WORKDIR /app/frontend
|
||||
COPY frontend/package*.json ./
|
||||
@@ -19,7 +25,7 @@ RUN npm install
|
||||
COPY frontend ./
|
||||
ENV VITE_GIT_URL=$VITE_GIT_URL
|
||||
ENV VITE_WEBSITE_URL=$VITE_WEBSITE_URL
|
||||
RUN npm run build
|
||||
RUN sed -i "s/{{VERSION}}/$(cat /tmp/version.txt)/g" package.json && npm run build
|
||||
|
||||
FROM oven/bun:1.1-alpine AS runner
|
||||
|
||||
|
||||
Reference in New Issue
Block a user