Docker Caddy Wordpress
Last active
September 27, 2022 14:28
-
-
Save refo/1ad0eafd6cc5b1937c977f3450b115ec to your computer and use it in GitHub Desktop.
Docker Caddy Wordpress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ./Dockerfile-wordpress/Dockerfile | |
FROM wordpress | |
ARG ARG_APACHE_LISTEN_PORT=8000 | |
ENV APACHE_LISTEN_PORT=${ARG_APACHE_LISTEN_PORT} | |
RUN sed -s -i -e "s/80/${APACHE_LISTEN_PORT}/" /etc/apache2/ports.conf /etc/apache2/sites-available/*.conf | |
USER www-data | |
EXPOSE ${APACHE_LISTEN_PORT} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ./server/caddy/Caddyfile | |
example.com { | |
header -server | |
header x-powered-by 220V | |
reverse_proxy blog:8000 { | |
header_down -x-redirect-by | |
header_down -link | |
header_down -x-powered-by | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.1' | |
services: | |
blog: | |
build: | |
context: Dockerfile-wordpress | |
args: | |
APACHE_LISTEN_PORT: 8080 | |
restart: unless-stopped | |
environment: | |
WORDPRESS_DB_HOST: db | |
WORDPRESS_DB_USER: blog_db | |
WORDPRESS_DB_PASSWORD: uNs3cuRe_P4s5w0rdd | |
WORDPRESS_DB_NAME: blog_db | |
volumes: | |
- ./wordpress:/var/www/html | |
networks: | |
- blog | |
db: | |
image: mysql:5.7 | |
restart: unless-stopped | |
environment: | |
MYSQL_DATABASE: blog_db | |
MYSQL_USER: blog_db | |
MYSQL_PASSWORD: uNs3cuRe_P4s5w0rdd | |
MYSQL_RANDOM_ROOT_PASSWORD: '1' | |
volumes: | |
- ./db:/var/lib/mysql | |
networks: | |
- blog | |
server: | |
image: caddy:alpine | |
restart: unless-stopped | |
ports: | |
- "80:80" | |
- "443:443" | |
volumes: | |
- ./server/caddy:/etc/caddy | |
- ./server/srv:/srv | |
- ./server/data:/data | |
- ./server/config:/config | |
networks: | |
- blog | |
networks: | |
blog: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment