Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
LOCAL_DOMAIN=docker.local
SUB_DOMAINS=
SUB_DOMAINS=*.env.docker.local
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ generate_certificate: ## Generate a trusted certificate for local domain
flesch/mkcert:latest \
mkcert -key-file ${LOCAL_DOMAIN}.key -cert-file ${LOCAL_DOMAIN}.crt *.${LOCAL_DOMAIN} ${SUB_DOMAINS} \
; \
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ${PWD}/certs/rootCA.pem \
sudo cp ${PWD}/certs/rootCA.pem /usr/local/share/ca-certificates/rootCA.pem && \
sudo cp ${PWD}/certs/${LOCAL_DOMAIN}.crt /usr/local/share/ca-certificates/${LOCAL_DOMAIN}.crt && \
sudo update-ca-certificates \
;

remove_certificate: ## Remove certificate generated for local domain
@rm ${PWD}/certs/${LOCAL_DOMAIN}.key && \
rm ${PWD}/certs/${LOCAL_DOMAIN}.crt && \
sudo security remove-trusted-cert -d ${PWD}/certs/rootCA.pem && \
sudo update-ca-certificates --fresh && \
rm ${PWD}/certs/rootCA-key.pem && \
rm ${PWD}/certs/rootCA.pem \
;
Expand Down Expand Up @@ -69,4 +71,4 @@ terminal-dnsmasq-ext: ## Enter in dnsmasq for host terminal
@docker exec -it dnsmasq-ext /bin/sh;

terminal-dnsmasq-int: ## Enter in dnsmasq for containers terminal
@docker exec -it dnsmasq-int /bin/sh;
@docker exec -it dnsmasq-int /bin/sh;
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Docker dev routing

> ⚠️ For Windows
>
> Use the git bash terminal with administrator rights to use makeFile commands


> This project is a Docker stack handling routing to containers during development.

When you come to work with docker locally, you can expose your containers on a given host ports, or eventually, you bind them to an url, and with a solution like jwilder/nginx-proxy, you achieve that goal pretty easily. But, because there is always a but, you have to update your /etc/hosts. And if you want your containers to communicate through their respective url, you will have to bind them (for example with option `--link my-container-name:my-freaky-url.test`). Furthermore, this linking makes them now codependant, and you can not run one without the other.
Expand Down
6 changes: 4 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ services:
ipv4_address: 172.25.0.255
ports:
- 80:80
- 443:443
# - 443:443
volumes:
- ./nginx-proxy.conf:/etc/nginx/conf.d/my_proxy.conf:ro
- /var/run/docker.sock:/tmp/docker.sock:ro
- ./certs:/etc/nginx/certs:ro
#- ./certs:/etc/nginx/certs:ro
restart: unless-stopped
# Dnsmasq for host
dnsmasq-ext:
Expand All @@ -38,6 +38,8 @@ services:
restart: unless-stopped

networks:
app_subnet:
external: false
default:
name: common
driver: bridge
Expand Down