29 lines
1.2 KiB
YAML
29 lines
1.2 KiB
YAML
# Define the services (containers) for your application
|
|
services:
|
|
# The name of our service
|
|
time-tracker-app:
|
|
# Build the Docker image from the Dockerfile in the current directory (.)
|
|
build: .
|
|
# Name the container for easier management
|
|
container_name: time-tracker
|
|
# Restart policy: always restart the container if it stops.
|
|
# This is useful for production environments to ensure the app is always running.
|
|
restart: always
|
|
# Keep the container running by allocating a pseudo-TTY
|
|
tty: true
|
|
# Port mapping: map port 3000 on the host machine to port 3000 in the container.
|
|
# This allows you to access the application via http://<your-server-ip>:3000
|
|
ports:
|
|
- "3004:3000"
|
|
# Volume mapping: persist the database file.
|
|
# This creates a 'data' folder in your project directory on the host machine
|
|
# and links it to the /usr/src/app/data directory inside the container.
|
|
# The timetracker.db will be stored here, ensuring data is not lost.
|
|
volumes:
|
|
- ./data:/usr/src/app/data
|
|
# Environment file: tells Docker Compose to use the .env file in the
|
|
# current directory to set environment variables inside the container.
|
|
env_file:
|
|
- .env
|
|
network_mode: bridge
|