docker-compose: build both images from source, bake frontend into nginx, use --build flag
This commit is contained in:
2
deploy/Dockerfile.nginx
Normal file
2
deploy/Dockerfile.nginx
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
FROM nginx:alpine
|
||||||
|
COPY . /usr/share/nginx/html
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
```bash
|
```bash
|
||||||
git clone https://gitea.ledrew.me/ledadmin/project-tracker.git
|
git clone https://gitea.ledrew.me/ledadmin/project-tracker.git
|
||||||
cd project-tracker/deploy
|
cd project-tracker/deploy
|
||||||
docker compose up -d
|
docker compose up -d --build
|
||||||
```
|
```
|
||||||
|
|
||||||
App available at `http://<your-server-ip>`
|
App available at `http://<your-server-ip>`
|
||||||
@@ -45,8 +45,9 @@ console.log('Seeded', items.length, 'projects');
|
|||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
```bash
|
```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 # View logs
|
||||||
|
docker compose logs -f backend # View backend logs only
|
||||||
docker compose restart # Restart
|
docker compose restart # Restart
|
||||||
docker compose down # Stop
|
docker compose down # Stop
|
||||||
docker compose down -v # Stop and DELETE database volume (CAREFUL!)
|
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
|
## Updating
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd project-tracker
|
|
||||||
git pull
|
git pull
|
||||||
docker compose down
|
docker compose down
|
||||||
docker compose build --no-cache
|
docker compose up -d --build
|
||||||
docker compose up -d
|
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
services:
|
services:
|
||||||
backend:
|
backend:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: ../backend
|
||||||
dockerfile: Dockerfile
|
dockerfile: ../deploy/Dockerfile
|
||||||
container_name: project-tracker-api
|
container_name: project-tracker-api
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
@@ -14,14 +14,13 @@ services:
|
|||||||
- project-tracker-net
|
- project-tracker-net
|
||||||
|
|
||||||
nginx:
|
nginx:
|
||||||
image: nginx:alpine
|
build:
|
||||||
|
context: ../frontend
|
||||||
|
dockerfile: ../deploy/Dockerfile.nginx
|
||||||
container_name: project-tracker-nginx
|
container_name: project-tracker-nginx
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "80:80"
|
||||||
volumes:
|
|
||||||
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
|
||||||
- ../frontend:/usr/share/nginx/html:ro
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- backend
|
- backend
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
@@ -478,7 +478,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const API = 'http://10.10.11.103/api';
|
const API = '/api';
|
||||||
let projects = [];
|
let projects = [];
|
||||||
let currentFilter = 'all';
|
let currentFilter = 'all';
|
||||||
let editingId = null;
|
let editingId = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user