docker-compose: build both images from source, bake frontend into nginx, use --build flag

This commit is contained in:
Ada
2026-04-06 09:41:20 -04:00
parent 49aa8adce4
commit a077bffb08
4 changed files with 16 additions and 16 deletions

2
deploy/Dockerfile.nginx Normal file
View File

@@ -0,0 +1,2 @@
FROM nginx:alpine
COPY . /usr/share/nginx/html

View File

@@ -5,7 +5,7 @@
```bash
git clone https://gitea.ledrew.me/ledadmin/project-tracker.git
cd project-tracker/deploy
docker compose up -d
docker compose up -d --build
```
App available at `http://<your-server-ip>`
@@ -45,8 +45,9 @@ console.log('Seeded', items.length, 'projects');
## Commands
```bash
docker compose up -d # Start
docker compose up -d --build # Build and start (always use --build to pick up code changes)
docker compose logs -f # View logs
docker compose logs -f backend # View backend logs only
docker compose restart # Restart
docker compose down # Stop
docker compose down -v # Stop and DELETE database volume (CAREFUL!)
@@ -85,11 +86,9 @@ docker exec -it project-tracker-api sh # Shell into backend container
## Updating
```bash
cd project-tracker
git pull
docker compose down
docker compose build --no-cache
docker compose up -d
docker compose up -d --build
```
---

View File

@@ -1,8 +1,8 @@
services:
backend:
build:
context: .
dockerfile: Dockerfile
context: ../backend
dockerfile: ../deploy/Dockerfile
container_name: project-tracker-api
restart: unless-stopped
volumes:
@@ -14,14 +14,13 @@ services:
- project-tracker-net
nginx:
image: nginx:alpine
build:
context: ../frontend
dockerfile: ../deploy/Dockerfile.nginx
container_name: project-tracker-nginx
restart: unless-stopped
ports:
- "80:80"
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
- ../frontend:/usr/share/nginx/html:ro
depends_on:
- backend
networks:

View File

@@ -478,7 +478,7 @@
</div>
<script>
const API = 'http://10.10.11.103/api';
const API = '/api';
let projects = [];
let currentFilter = 'all';
let editingId = null;