Docker Setup
Run Fitness Tracker using Docker for easy deployment and consistent environments.
Prerequisites
- Docker Desktop installed
- Docker Compose (included with Docker Desktop)
Quick Start
cd fitness-tracker-laravel
docker compose up --build
Access the application at http://localhost:8000
Docker Files
The project includes these Docker configuration files:
Dockerfile
FROM php:8.2-fpm
WORKDIR /var/www/html
# Install dependencies
RUN apt-get update && apt-get install -y \
git curl libpng-dev libonig-dev libxml2-dev \
zip unzip sqlite3 libsqlite3-dev nodejs npm
# Install PHP extensions
RUN docker-php-ext-install pdo pdo_sqlite mbstring exif pcntl bcmath gd
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
COPY . .
RUN composer install --optimize-autoloader --no-dev
EXPOSE 9000
ENTRYPOINT ["/usr/local/bin/setup.sh"]
CMD ["php-fpm"]
docker-compose.yml
version: '3.8'
services:
app:
build: .
container_name: fitness-tracker-app
volumes:
- ./:/var/www/html
environment:
- APP_ENV=local
- DB_CONNECTION=sqlite
- CACHE_STORE=file
- SESSION_DRIVER=file
nginx:
image: nginx:alpine
container_name: fitness-tracker-nginx
ports:
- "8000:80"
volumes:
- ./:/var/www/html
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
depends_on:
- app
Commands
Start containers
Start in background
Rebuild containers
docker compose up --build
Stop containers
View logs
Access app container
docker compose exec app bash
Run artisan commands
docker compose exec app php artisan migrate
docker compose exec app php artisan tinker
Environment Variables
The following environment variables can be configured in docker-compose.yml: