24 lines
728 B
Docker
24 lines
728 B
Docker
# Base image
|
|
FROM nginx
|
|
|
|
ENV DOMAIN=translator.dhbw.flokaiser.com
|
|
ENV EMAIL=inf20155@lehre.dhbw-stuttgart.de
|
|
|
|
# Install necessary packages
|
|
RUN apt-get update && \
|
|
apt-get install -y certbot python-certbot-nginx
|
|
|
|
# Generate SSL certificates using Let's Encrypt
|
|
RUN certbot certonly --standalone --preferred-challenges http -d ${DOMAIN} -n -m ${EMAIL} --agree-tos --force-renewal && \
|
|
ln -s /etc/letsencrypt/live/${DOMAIN}/fullchain.pem /etc/nginx/certs/cert.pem && \
|
|
ln -s /etc/letsencrypt/live/${Domain}/privkey.pem /etc/nginx/certs/key.pem
|
|
|
|
# Copy NGINX configuration file
|
|
COPY ./proxy/nginx.conf /etc/nginx/nginx.conf
|
|
|
|
# Expose port 80 and 443
|
|
EXPOSE 80
|
|
EXPOSE 443
|
|
|
|
# Start NGINX
|
|
CMD ["nginx", "-g", "daemon off;"] |