build one nginx one spa one cerbot and set settings

This commit is contained in:
2025-05-27 14:52:43 +03:00
parent a4a282e207
commit b23aebab4c
7 changed files with 147 additions and 47 deletions
+3 -17
View File
@@ -1,25 +1,11 @@
FROM nginx:latest
# Устанавливаем Certbot и зависимости
RUN apt-get update && \
apt-get install -y certbot python3-certbot-nginx cron && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN mkdir -p /var/www/yalarba.ru/html
COPY spa_app/index.html /var/www/yalarba.ru/html
# Удаляем дефолтный конфиг Nginx
RUN rm /etc/nginx/conf.d/default.conf
# Копируем ваш Nginx-конфиг и скрипты
COPY yalarba.ru.conf /etc/nginx/conf.d/
COPY startup.sh /usr/local/bin/
COPY renew-certs.sh /usr/local/bin/
# Даем права на выполнение скриптов
RUN chmod +x /usr/local/bin/startup.sh /usr/local/bin/renew-certs.sh
# Добавляем cron-задачу для обновления сертификатов
RUN echo "0 3 * * * /usr/local/bin/renew-certs.sh >> /var/log/cron.log 2>&1" > /etc/cron.d/certbot-renew
RUN chmod 0644 /etc/cron.d/certbot-renew
# Запускаем cron и Nginx при старте
CMD ["/usr/local/bin/startup.sh"]