initial
This commit is contained in:
+53
@@ -0,0 +1,53 @@
|
||||
# Multi-stage build for MTG Search
|
||||
# Stage 1: Build backend and frontend
|
||||
FROM eclipse-temurin:21-jdk as builder
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# Install Node.js
|
||||
RUN apt-get update && apt-get install -y curl && \
|
||||
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
|
||||
apt-get install -y nodejs && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy gradle files
|
||||
COPY gradle gradle
|
||||
COPY gradlew .
|
||||
COPY build.gradle.kts .
|
||||
COPY settings.gradle.kts .
|
||||
COPY gradle.properties .
|
||||
|
||||
# Copy backend source
|
||||
COPY backend backend
|
||||
|
||||
# Copy frontend source
|
||||
COPY frontend frontend
|
||||
|
||||
# Build backend
|
||||
WORKDIR /build/backend
|
||||
RUN ../gradlew build -x test
|
||||
|
||||
# Build frontend
|
||||
WORKDIR /build/frontend
|
||||
RUN npm ci && npm run build
|
||||
|
||||
# Stage 2: Runtime
|
||||
FROM eclipse-temurin:21-jre
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install curl for health checks
|
||||
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy built backend jar
|
||||
COPY --from=builder /build/backend/build/libs/*.jar app.jar
|
||||
|
||||
# Expose port
|
||||
EXPOSE 8080
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
||||
CMD curl -f http://localhost:8080/api/v1/auth/health || exit 1
|
||||
|
||||
# Run application
|
||||
ENTRYPOINT ["java", "-jar", "app.jar"]
|
||||
Reference in New Issue
Block a user