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_PASSWORD=42theboss42
|
||||||
WP_ADMIN_EMAIL=inception@duinvoetje.nl
|
WP_ADMIN_EMAIL=inception@duinvoetje.nl
|
||||||
|
|
||||||
WP_THEME=twentytwentyfour
|
WP_THEME=impressionist
|
||||||
|
|
||||||
WP_USER=inception
|
WP_USER=inception
|
||||||
WP_USER_PASSWORD=42inception42
|
WP_USER_PASSWORD=42inception42
|
||||||
|
|||||||
@ -12,8 +12,6 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: ./requirements/mariadb
|
context: ./requirements/mariadb
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
ports:
|
|
||||||
- '3306:3306'
|
|
||||||
networks:
|
networks:
|
||||||
- docker-network
|
- docker-network
|
||||||
volumes:
|
volumes:
|
||||||
@ -23,14 +21,17 @@ services:
|
|||||||
nginx:
|
nginx:
|
||||||
restart: always
|
restart: always
|
||||||
container_name: nginx
|
container_name: nginx
|
||||||
|
environment:
|
||||||
|
- DOMAIN_NAME=${DOMAIN_NAME}
|
||||||
build:
|
build:
|
||||||
context: ./requirements/nginx
|
context: ./requirements/nginx
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
args:
|
||||||
|
DOMAIN_NAME: ${DOMAIN_NAME}
|
||||||
depends_on:
|
depends_on:
|
||||||
- wordpress
|
- wordpress
|
||||||
ports:
|
ports:
|
||||||
- '443:443'
|
- '443:443'
|
||||||
- '80:80'
|
|
||||||
networks:
|
networks:
|
||||||
- docker-network
|
- docker-network
|
||||||
volumes:
|
volumes:
|
||||||
@ -45,29 +46,28 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- mariadb
|
- mariadb
|
||||||
environment:
|
environment:
|
||||||
- DOMAIN_NAME=whaffman.42.fr
|
- DOMAIN_NAME=${DOMAIN_NAME}
|
||||||
|
|
||||||
- MYSQL_DATABASE=wordpress
|
- MYSQL_DATABASE=${MYSQL_DATABASE}
|
||||||
- MYSQL_USER=wordpress
|
- MYSQL_USER=${MYSQL_USER}
|
||||||
- MYSQL_PASSWORD=42wordpress42
|
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
|
||||||
|
|
||||||
- DB_HOST=mariadb
|
- DB_HOST=${DB_HOST}
|
||||||
- DB_PORT=3306
|
- DB_PORT=${DB_PORT}
|
||||||
|
|
||||||
- WP_TITLE=Inception
|
- WP_TITLE=${WP_TITLE}
|
||||||
- WP_DESCRIPTION=Inception project
|
- WP_DESCRIPTION=${WP_DESCRIPTION}
|
||||||
|
|
||||||
- WP_ADMIN=theboss
|
- WP_ADMIN=${WP_ADMIN}
|
||||||
- WP_ADMIN_PASSWORD=42theboss42
|
- WP_ADMIN_PASSWORD=${WP_ADMIN_PASSWORD}
|
||||||
- WP_ADMIN_EMAIL=inception@duinvoetje.nl
|
- 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:
|
networks:
|
||||||
- docker-network
|
- docker-network
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
@ -30,7 +30,7 @@ COPY ./conf/my.cnf /etc/my.cnf
|
|||||||
# COPY ./init.sql /usr/local/bin/init.sql
|
# COPY ./init.sql /usr/local/bin/init.sql
|
||||||
|
|
||||||
# Expose the MySQL port
|
# Expose the MySQL port
|
||||||
EXPOSE 3306
|
#EXPOSE 3306
|
||||||
|
|
||||||
# Set the user and group to run the container
|
# Set the user and group to run the container
|
||||||
|
|
||||||
@ -46,4 +46,5 @@ ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
|||||||
|
|
||||||
# Start the MariaDB server
|
# Start the MariaDB server
|
||||||
CMD ["mysqld", "--datadir=/var/lib/mysql", "--user=mariadb"]
|
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
|
FROM alpine:3.20
|
||||||
|
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
nginx &&\
|
nginx \
|
||||||
|
openssl \
|
||||||
|
curl &&\
|
||||||
rm -rf /var/cache/apk/*
|
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
|
COPY ./conf/nginx.conf /etc/nginx/nginx.conf
|
||||||
EXPOSE 80
|
EXPOSE 443
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
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,9 +10,13 @@ http {
|
|||||||
default_type application/octet-stream;
|
default_type application/octet-stream;
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 443 ssl;
|
||||||
server_name localhost;
|
server_name ${DOMAIN_NAME};
|
||||||
root /var/www/html;
|
|
||||||
|
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;
|
access_log /var/log/nginx/example.localhost-access.log;
|
||||||
error_log /var/log/nginx/example.localhost-error.log error;
|
error_log /var/log/nginx/example.localhost-error.log error;
|
||||||
|
|||||||
@ -14,7 +14,8 @@ RUN apk add --no-cache \
|
|||||||
php83-gd \
|
php83-gd \
|
||||||
php83-session \
|
php83-session \
|
||||||
mariadb-client \
|
mariadb-client \
|
||||||
curl &&\
|
curl \
|
||||||
|
busybox-extras &&\
|
||||||
rm -rf /var/cache/apk/*
|
rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
# Add a new user and group
|
# Add a new user and group
|
||||||
@ -44,3 +45,5 @@ RUN chmod +x /usr/local/bin/install.sh
|
|||||||
ENTRYPOINT ["/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