Docker deployment
This documentation walks through how to deploy Headsign using Docker and using the project’s Dockerfiles.
Included Dockerfiles
Section titled “Included Dockerfiles”This project has three Dockerfiles:
- Dockerfile - the primary Dockerfile with BuildKit cache mounts (this is how we build all standard images)
- Dockerfile.railway - a Dockerfile optimized for Railway’s build process, by removing cache mounts.
- Dockerfile.legacy - the “original” Dockerfile for this project, used on Docker builds before v1.3.2
Included Docker Compose files
Section titled “Included Docker Compose files”This project has two Docker Compose files:
- compose.yaml - a production-ready Docker Compose file that uses the prebuilt Docker image
- compose.dev.yaml - a Docker Compose file that builds the Docker image and has dev settings. This is what this documentation will use.
Deployment instructions
Section titled “Deployment instructions”These instructions assume you’ve followed steps 1 and 2 in the Docker section in docs/getting-started.md
- Clone repository and configure environment variables:
# clone the repositorygit clone https://github.com/jasonad123/headsign.gitcd headsign
# copy the .env.example filecp .env.example .env
# Review and edit .env file with your API keynano .env- Deploy Using Docker Compose:
# Production builddocker compose -f compose.dev.yaml --profile production up -d
# View logsdocker compose logs
# Stopdocker compose down --remove-orphansFor development with hot reload:
# copy the .env.example file to env.development# and change the variables as necessarycp .env.example .env.development.local
# then use this command to start the Docker Compose file with the dev serverdocker compose -f compose.dev.yaml --profile dev up
# Stop thisdocker compose down --remove-orphans- Using Docker build directly:
# Build the SvelteKit imagedocker build -f Dockerfile .
# Run the containerdocker run -p 8080:8080 --env-file .env headsign-svelte