Migrate backend from Go to Quarkus (Java 21 / JAX-RS)
- Replaced Go stdlib server with Quarkus (RESTEasy Reactive + Jackson) - 7 Java classes: Game POJO, GameService (JSON file I/O), 4 REST resources, static file serving - Same JSON-per-game storage, same ZIP upload + bundle creation - Same Svelte frontend (unchanged), built into the JAR via maven-resources-plugin - Multi-stage Dockerfile: Node → Maven → JRE runtime
This commit is contained in:
+14
-13
@@ -1,4 +1,4 @@
|
||||
# Dostalgia — Multi-stage Docker build
|
||||
# Dostalgia — Quarkus multi-stage build
|
||||
|
||||
# ─── 1. Build frontend ───────────────────────────
|
||||
FROM node:20-bookworm AS frontend
|
||||
@@ -6,22 +6,23 @@ WORKDIR /build
|
||||
COPY frontend/package.json frontend/package-lock.json ./
|
||||
RUN npm ci 2>/dev/null || npm install --legacy-peer-deps
|
||||
COPY frontend/ ./
|
||||
RUN npx vite build
|
||||
RUN npm run build
|
||||
|
||||
# ─── 2. Build Go binary ──────────────────────────
|
||||
FROM golang:1.23-bookworm AS gobuild
|
||||
# ─── 2. Build Quarkus app ────────────────────────
|
||||
FROM maven:3-eclipse-temurin-21 AS build
|
||||
WORKDIR /build
|
||||
COPY go.mod ./
|
||||
COPY *.go ./
|
||||
COPY pom.xml ./
|
||||
COPY src ./src
|
||||
# Copy the built frontend into the source tree so maven-resources-plugin picks it up
|
||||
COPY --from=frontend /build/dist ./frontend/dist/
|
||||
RUN CGO_ENABLED=0 go build -o /dostalgia .
|
||||
RUN mvn package -DskipTests -q
|
||||
|
||||
# ─── 3. Runtime ──────────────────────────────────
|
||||
FROM debian:bookworm-slim
|
||||
RUN apt-get update -qq && apt-get install -y -qq --no-install-recommends ca-certificates tzdata && rm -rf /var/lib/apt/lists/*
|
||||
COPY --from=gobuild /dostalgia /dostalgia
|
||||
VOLUME /data
|
||||
FROM eclipse-temurin:21-jre-alpine
|
||||
WORKDIR /app
|
||||
# Quarkus uber-jar layout
|
||||
COPY --from=build /build/target/quarkus-app/ /app/
|
||||
EXPOSE 8765
|
||||
VOLUME /data
|
||||
ENV DOSTALGIA_DATA=/data
|
||||
ENV PORT=8765
|
||||
ENTRYPOINT ["/dostalgia"]
|
||||
ENTRYPOINT ["java", "-jar", "quarkus-run.jar"]
|
||||
|
||||
Reference in New Issue
Block a user