26 lines
696 B
Docker
26 lines
696 B
Docker
# Use a minimal java image
|
|
FROM openjdk:21-jdk-slim
|
|
|
|
# Define build-time argument with default value
|
|
ARG APP_PORT=8090
|
|
ENV QUARKUS_HTTP_PORT=$APP_PORT
|
|
|
|
# Set the working directory inside the container
|
|
WORKDIR /work/
|
|
|
|
# Set proper permissions for user 1001
|
|
RUN chown 1001 /work \
|
|
&& chmod "g+rwX" /work
|
|
|
|
# Copy the entire Quarkus app folder and set ownership
|
|
COPY --chown=1001:root quarkus-app/ /work/quarkus-app
|
|
|
|
# Expose the application's port
|
|
EXPOSE $APP_PORT
|
|
|
|
# Switch to non-root user for better security
|
|
USER 1001
|
|
|
|
# Define the entrypoint to run the JAR
|
|
CMD ["java", "-Dquarkus.http.host=0.0.0.0", "-Dquarkus.http.port=${QUARKUS_HTTP_PORT}", "-jar", "/work/quarkus-app/quarkus-run.jar"]
|