Skip to content

Commit

Permalink
Make Docker image command more flexible
Browse files Browse the repository at this point in the history
Ideally, the application should automatically download the data on
startup if it detects that no data file has been passed. This will be
added in the future.
  • Loading branch information
kencx committed Nov 5, 2023
1 parent df17194 commit e28a9cd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ WORKDIR /
COPY --from=builder --chmod=+x /app/sxkcd /app/entrypoint.sh ./
EXPOSE 6380
ENTRYPOINT [ "/entrypoint.sh" ]
CMD ["server", "-p", "6380", "-r", "redis:6379"]
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ Start your own instance of `sxkcd` with the provided `docker-compose.yml`:
```bash
# download all comic data
$ docker compose run \
--rm -d \
--rm \
--no-deps \
--entrypoint "./sxkcd" \
app download -f /data/comics.json

$ docker-compose -d
Expand Down Expand Up @@ -84,9 +83,8 @@ Run with docker-compose:
```bash
# download all comic data
$ docker compose run \
--rm -d \
--rm \
--no-deps \
--entrypoint "./sxkcd" \
app download -f /data/comics.json

$ docker-compose -d
Expand Down
9 changes: 6 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ services:
container_name: sxkcd
hostname: sxkcd
image: ghcr.io/kencx/sxkcd:latest
build: .
# uncomment on first startup
# command: ["-f", "/data/comics.json"]
build:
context: .
tags:
- latest
# run "docker compose run --rm app download -f /data/comics.json" prior to starting
command: ["server", "-p", "6380", "-r", "redis:6379", "-f", "/data/comics.json"]
restart: unless-stopped
ports:
- "6380:6380"
Expand Down
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

exec ./sxkcd server -p 6380 -r redis:6379 "$@"
exec ./sxkcd "$@"

0 comments on commit e28a9cd

Please sign in to comment.