Skip to content

Commit 022f13f

Browse files
exedevexedev-shelley
andcommitted
Simplify docker-compose: single service, --build for source
Co-authored-by: Shelley <shelley@exe.dev>
1 parent 13dc6d3 commit 022f13f

File tree

2 files changed

+23
-36
lines changed

2 files changed

+23
-36
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ PORT=3000 ./stock-fetcher # starts on :3000
2828
# Using published image
2929
docker compose up -d
3030

31-
# Local build
32-
docker compose --profile local up stock-fetcher-local -d
31+
# Build from source
32+
docker compose up -d --build
3333
```
3434

3535
Cache is persisted in a named volume (`cache-data``/data/cache.db`).

docker-compose.yml

Lines changed: 21 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,30 @@
1-
x-common: &common
2-
ports:
3-
- "8080:8080"
4-
environment:
5-
- TZ=UTC
6-
user: "8080:8080"
7-
read_only: true
8-
volumes:
9-
- cache-data:/data
10-
security_opt:
11-
- no-new-privileges:true
12-
cap_drop:
13-
- all
14-
restart: unless-stopped
15-
healthcheck:
16-
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8080/api/health"]
17-
interval: 30s
18-
timeout: 10s
19-
retries: 3
20-
start_period: 5s
21-
221
services:
23-
# Published image (use: docker compose --profile prod up -d)
2+
# Build form source (use: docker compose up -d --build)
243
stock-fetcher:
25-
<<: *common
264
image: ghcr.io/johnwmail/stock-fetcher:latest
27-
container_name: stock-fetcher
28-
profiles:
29-
- prod
30-
31-
# Local build (use: docker compose --profile local up -d)
32-
stock-fetcher-local:
33-
<<: *common
345
build:
356
context: .
367
dockerfile: Dockerfile
37-
image: stock-fetcher:local
38-
container_name: stock-fetcher-local
39-
profiles:
40-
- local
8+
container_name: stock-fetcher
9+
ports:
10+
- "8080:8080"
11+
environment:
12+
- TZ=UTC
13+
user: "8080:8080"
14+
read_only: true
15+
volumes:
16+
- cache-data:/data
17+
security_opt:
18+
- no-new-privileges:true
19+
cap_drop:
20+
- all
21+
restart: unless-stopped
22+
healthcheck:
23+
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8080/api/health"]
24+
interval: 30s
25+
timeout: 10s
26+
retries: 3
27+
start_period: 5s
4128

4229
volumes:
4330
cache-data:

0 commit comments

Comments
 (0)