A Docker Compose-based Node.js development environment with nginx-proxy and Let's Encrypt SSL/TLS support.
- Docker
- Docker Compose
- nginx-proxy (running as external network
my_proxy_network)
- Create
.envfile:
cp .env.example .env- Edit
.envfile and configure the required environment variables:
CONTAINER_NAME=my_node_app
REPOSITORY=src
DOCKER_PATH=Infra
VIRTUAL_HOST=example.com
VIRTUAL_PORT=3000
LETSENCRYPT_HOST=example.com
LETSENCRYPT_EMAIL=your-email@example.com
LETSENCRYPT_TEST=true
CERT_NAME=default
CONTAINER_NAME: Docker container nameREPOSITORY: Application source code directoryDOCKER_PATH: Directory containing DockerfileVIRTUAL_HOST: Hostname used by nginx-proxyVIRTUAL_PORT: Port number that the application listens onLETSENCRYPT_HOST: Domain for SSL certificateLETSENCRYPT_EMAIL: Email address for Let's EncryptLETSENCRYPT_TEST: Set totruefor testing (usefalsein production)CERT_NAME: Certificate name
docker-compose up -ddocker-compose downdocker-compose logs -fdocker-compose exec app sh.
├── Infra/ # Docker related files
│ └── Dockerfile
├── src/ # Application source code
├── docker-compose.yml # Docker Compose configuration
├── .env.example # Environment variables template
└── README.md
This project uses two networks:
my_nodejs_network: Internal network for the applicationmy_proxy_network: External network for nginx-proxy connection
my_proxy_networkmust be created beforehand- For production use, set
LETSENCRYPT_TESTtofalsein.env - SSL certificates are automatically obtained and renewed by Let's Encrypt
MIT License - see LICENSE for details