healthcheck and ssl working only expose 443
This commit is contained in:
parent
8ded6e8358
commit
96e9821448
@ -15,7 +15,7 @@ WP_ADMIN=theboss
|
||||
WP_ADMIN_PASSWORD=42theboss42
|
||||
WP_ADMIN_EMAIL=inception@duinvoetje.nl
|
||||
|
||||
WP_THEME=twentytwentyfour
|
||||
WP_THEME=impressionist
|
||||
|
||||
WP_USER=inception
|
||||
WP_USER_PASSWORD=42inception42
|
||||
|
||||
@ -12,8 +12,6 @@ services:
|
||||
build:
|
||||
context: ./requirements/mariadb
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- '3306:3306'
|
||||
networks:
|
||||
- docker-network
|
||||
volumes:
|
||||
@ -23,14 +21,17 @@ services:
|
||||
nginx:
|
||||
restart: always
|
||||
container_name: nginx
|
||||
environment:
|
||||
- DOMAIN_NAME=${DOMAIN_NAME}
|
||||
build:
|
||||
context: ./requirements/nginx
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
DOMAIN_NAME: ${DOMAIN_NAME}
|
||||
depends_on:
|
||||
- wordpress
|
||||
ports:
|
||||
- '443:443'
|
||||
- '80:80'
|
||||
networks:
|
||||
- docker-network
|
||||
volumes:
|
||||
@ -45,29 +46,28 @@ services:
|
||||
depends_on:
|
||||
- mariadb
|
||||
environment:
|
||||
- DOMAIN_NAME=whaffman.42.fr
|
||||
- DOMAIN_NAME=${DOMAIN_NAME}
|
||||
|
||||
- MYSQL_DATABASE=wordpress
|
||||
- MYSQL_USER=wordpress
|
||||
- MYSQL_PASSWORD=42wordpress42
|
||||
|
||||
- DB_HOST=mariadb
|
||||
- DB_PORT=3306
|
||||
- MYSQL_DATABASE=${MYSQL_DATABASE}
|
||||
- MYSQL_USER=${MYSQL_USER}
|
||||
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
|
||||
|
||||
- DB_HOST=${DB_HOST}
|
||||
- DB_PORT=${DB_PORT}
|
||||
|
||||
- WP_TITLE=Inception
|
||||
- WP_DESCRIPTION=Inception project
|
||||
- WP_TITLE=${WP_TITLE}
|
||||
- WP_DESCRIPTION=${WP_DESCRIPTION}
|
||||
|
||||
- WP_ADMIN=theboss
|
||||
- WP_ADMIN_PASSWORD=42theboss42
|
||||
- WP_ADMIN_EMAIL=inception@duinvoetje.nl
|
||||
- WP_ADMIN=${WP_ADMIN}
|
||||
- WP_ADMIN_PASSWORD=${WP_ADMIN_PASSWORD}
|
||||
- WP_ADMIN_EMAIL=${WP_ADMIN_EMAIL}
|
||||
|
||||
- WP_THEME=twentytwentyfour
|
||||
- WP_THEME=${WP_THEME}
|
||||
|
||||
- WP_USER=${WP_USER}
|
||||
- WP_USER_PASSWORD=${WP_USER_PASSWORD}
|
||||
- WP_USER_EMAIL=${WP_USER_EMAIL}
|
||||
|
||||
- WP_USER=inception
|
||||
- WP_USER_PASSWORD=42inception42
|
||||
- WP_USER_EMAIL=inception@duinvoetje.nl
|
||||
ports:
|
||||
- '9000:9000'
|
||||
networks:
|
||||
- docker-network
|
||||
volumes:
|
||||
|
||||
@ -30,7 +30,7 @@ COPY ./conf/my.cnf /etc/my.cnf
|
||||
# COPY ./init.sql /usr/local/bin/init.sql
|
||||
|
||||
# Expose the MySQL port
|
||||
EXPOSE 3306
|
||||
#EXPOSE 3306
|
||||
|
||||
# Set the user and group to run the container
|
||||
|
||||
@ -46,4 +46,5 @@ ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
||||
|
||||
# Start the MariaDB server
|
||||
CMD ["mysqld", "--datadir=/var/lib/mysql", "--user=mariadb"]
|
||||
HEALTHCHECK --interval=5s --timeout=3s --start-period=5s --retries=1 CMD mysqladmin ping -h localhost || exit 1
|
||||
|
||||
|
||||
@ -1,9 +1,19 @@
|
||||
FROM alpine:3.20
|
||||
|
||||
RUN apk add --no-cache \
|
||||
nginx &&\
|
||||
nginx \
|
||||
openssl \
|
||||
curl &&\
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
ARG DOMAIN_NAME
|
||||
|
||||
RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
|
||||
-keyout /etc/ssl/private/nginx-selfsigned.key \
|
||||
-out /etc/ssl/certs/nginx-selfsigned.crt \
|
||||
-subj "/CN=${DOMAIN_NAME}"
|
||||
|
||||
COPY ./conf/nginx.conf /etc/nginx/nginx.conf
|
||||
EXPOSE 80
|
||||
EXPOSE 443
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
HEALTHCHECK --interval=5s --timeout=3s --start-period=5s --retries=1 CMD curl --insecure -f https://127.0.0.1:443/ || exit 1
|
||||
|
||||
@ -10,10 +10,14 @@ http {
|
||||
default_type application/octet-stream;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
root /var/www/html;
|
||||
listen 443 ssl;
|
||||
server_name ${DOMAIN_NAME};
|
||||
|
||||
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
|
||||
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
|
||||
|
||||
root /var/www/html;
|
||||
|
||||
access_log /var/log/nginx/example.localhost-access.log;
|
||||
error_log /var/log/nginx/example.localhost-error.log error;
|
||||
index index.html index.htm index.php;
|
||||
|
||||
@ -14,7 +14,8 @@ RUN apk add --no-cache \
|
||||
php83-gd \
|
||||
php83-session \
|
||||
mariadb-client \
|
||||
curl &&\
|
||||
curl \
|
||||
busybox-extras &&\
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
# Add a new user and group
|
||||
@ -43,4 +44,6 @@ RUN chmod +x /usr/local/bin/install.sh
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/install.sh"]
|
||||
|
||||
CMD ["php-fpm83", "-F"]
|
||||
CMD ["php-fpm83", "-F"]
|
||||
HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD nc -z 127.0.0.1 9000 || exit 1
|
||||
Loading…
Reference in New Issue
Block a user