This commit is contained in:
parent
6f05638ecb
commit
f0abdcb02f
@ -1,22 +1,30 @@
|
|||||||
FROM maven:3.8.5-openjdk-17-slim
|
# Stage 1: Build
|
||||||
|
FROM maven:3.8.5-openjdk-17-slim AS build
|
||||||
|
|
||||||
# Set the working directory
|
|
||||||
WORKDIR /home/container
|
WORKDIR /home/container
|
||||||
|
|
||||||
# Copy project files
|
# Copy only the files needed for the build
|
||||||
COPY . .
|
COPY pom.xml ./
|
||||||
|
COPY src ./src
|
||||||
|
|
||||||
# Build the app
|
# Build the app
|
||||||
RUN mvn clean package -q -DskipTests -T4C
|
RUN mvn clean package -q -DskipTests -T4C
|
||||||
|
|
||||||
# Exposting on port 80 so we can
|
# Stage 2: Runtime
|
||||||
# access via a reverse proxy for Dokku
|
FROM openjdk:17-jdk-slim
|
||||||
ENV HOSTNAME "0.0.0.0"
|
|
||||||
EXPOSE 80
|
|
||||||
ENV PORT 80
|
|
||||||
|
|
||||||
# We're running in production
|
WORKDIR /home/container
|
||||||
ENV APP_ENV "production"
|
|
||||||
|
# Copy the jar from the build stage
|
||||||
|
COPY --from=build /home/container/target/TextPurify-API.jar ./TextPurify-API.jar
|
||||||
|
|
||||||
|
# Expose port
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
# Set environment variables
|
||||||
|
ENV HOSTNAME="0.0.0.0"
|
||||||
|
ENV PORT=80
|
||||||
|
ENV APP_ENV="production"
|
||||||
|
|
||||||
# Start the app
|
# Start the app
|
||||||
CMD ["java", "-jar", "target/TextPurify-API.jar"]
|
CMD ["java", "-jar", "TextPurify-API.jar"]
|
Loading…
x
Reference in New Issue
Block a user