1
This commit is contained in:
@@ -3,28 +3,28 @@ FROM cirrusci/flutter:3.3.0 as flutter_builder
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy Flutter project files
|
# Copy Flutter project files
|
||||||
COPY AINoval/pubspec.yaml AINoval/pubspec.lock ./AINoval/
|
COPY AINoval/pubspec.yaml AINoval/pubspec.lock ./
|
||||||
RUN cd AINoval && flutter pub get
|
RUN flutter pub get
|
||||||
|
|
||||||
# Copy the rest of the Flutter project source code
|
# Copy the rest of the Flutter project source code
|
||||||
COPY AINoval/ ./AINoval/
|
COPY AINoval/ ./
|
||||||
|
|
||||||
# Build the Flutter web application
|
# Build the Flutter web application
|
||||||
RUN cd AINoval && flutter build web --release --web-renderer canvaskit
|
RUN flutter build web --release --web-renderer canvaskit
|
||||||
|
|
||||||
# Stage 2: Build the Java Spring Boot server
|
# Stage 2: Build the Java Spring Boot server
|
||||||
FROM maven:3.9-eclipse-temurin-21 as java_builder
|
FROM maven:3.9-eclipse-temurin-21 as java_builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy only the pom.xml to leverage Docker cache for dependencies
|
# Copy only the pom.xml to leverage Docker cache for dependencies
|
||||||
COPY AINovalServer/pom.xml ./AINovalServer/
|
COPY AINovalServer/pom.xml ./
|
||||||
RUN mvn -f AINovalServer/pom.xml dependency:go-offline
|
RUN mvn dependency:go-offline
|
||||||
|
|
||||||
# Copy the rest of the server source code
|
# Copy the rest of the server source code
|
||||||
COPY AINovalServer/ ./AINovalServer/
|
COPY AINovalServer/ ./
|
||||||
|
|
||||||
# Build the application, skipping tests to speed up the process
|
# Build the application, skipping tests to speed up the process
|
||||||
RUN mvn -f AINovalServer/pom.xml clean package -DskipTests
|
RUN mvn clean package -DskipTests
|
||||||
|
|
||||||
# Stage 3: Create the final runtime image
|
# Stage 3: Create the final runtime image
|
||||||
FROM eclipse-temurin:21-jre
|
FROM eclipse-temurin:21-jre
|
||||||
@@ -42,10 +42,10 @@ ENV JAVA_TOOL_OPTIONS="--add-opens=java.base/java.math=ALL-UNNAMED --add-opens=j
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy the server jar from the java_builder stage and rename it
|
# Copy the server jar from the java_builder stage and rename it
|
||||||
COPY --from=java_builder /app/AINovalServer/target/ai-novel-server-0.0.1-SNAPSHOT.jar /app/ainoval-server.jar
|
COPY --from=java_builder /app/target/ai-novel-server-0.0.1-SNAPSHOT.jar /app/ainoval-server.jar
|
||||||
|
|
||||||
# Copy the built web assets from the flutter_builder stage
|
# Copy the built web assets from the flutter_builder stage
|
||||||
COPY --from=flutter_builder /app/AINoval/build/web/ /app/web/
|
COPY --from=flutter_builder /app/build/web/ /app/web/
|
||||||
|
|
||||||
EXPOSE 18080
|
EXPOSE 18080
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user