-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile.https
More file actions
26 lines (18 loc) · 757 Bytes
/
Copy pathDockerfile.https
File metadata and controls
26 lines (18 loc) · 757 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Stage 1: Build the Spring Boot application
FROM openjdk:17-slim AS build
ARG JAR_FILE=build/libs/housekeeping-0.0.1-SNAPSHOT.jar
COPY ${JAR_FILE} app.jar
# Stage 2: Set up Nginx and Spring Boot application
FROM nginx:alpine
# Install Java
RUN apk add --no-cache openjdk17-jre certbot certbot-nginx openssl
# Copy the built JAR file and Nginx config
COPY --from=build /app.jar /app.jar
COPY nginx.https.conf /etc/nginx/conf.d/default.conf
# Create necessary directories for Certbot and Nginx
RUN mkdir -p /var/www/certbot /etc/letsencrypt
# RUN openssl dhparam -out /etc/letsencrypt/ssl-dhparams.pem 2048
# Expose port for HTTP
EXPOSE 80
# Start Nginx and the Spring Boot application
CMD ["sh", "-c", "java -jar /app.jar & nginx -g 'daemon off;'"]