Skip to content

Commit c3382e2

Browse files
committed
Make cache directory a Docker volume
1 parent a6408bd commit c3382e2

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
FROM node:22-alpine
22
MAINTAINER Candid Dauth <[email protected]>
33

4+
ENTRYPOINT /opt/facilmap/entrypoint.sh
45
CMD yarn run prod-server
56
EXPOSE 8080
67
ENV CACHE_DIR=/opt/facilmap/cache
8+
VOLUME /opt/facilmap/cache
79
HEALTHCHECK --start-period=60s --start-interval=3s --timeout=5s --retries=1 \
810
CMD wget -O/dev/null 'http://127.0.0.1:8080/socket.io/?EIO=4&transport=polling' || exit 1
911

@@ -23,6 +25,4 @@ RUN yarn install && \
2325
yarn run build:server && \
2426
yarn workspaces focus -A --production
2527

26-
RUN mkdir -p "$CACHE_DIR" && chown -R facilmap:facilmap "$CACHE_DIR"
27-
28-
USER facilmap
28+
RUN mkdir -p "$CACHE_DIR" && chown -R facilmap:facilmap "$CACHE_DIR"

docs/src/developers/server/docker.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ services:
3636
MAXMIND_USER_ID: # Sign up here https://www.maxmind.com/en/geolite2/signup (needed for geoip lookup to show initial map state)
3737
MAXMIND_LICENSE_KEY:
3838
LIMA_LABS_TOKEN: # Get an API key on https://maps.lima-labs.com/ (optional, needed for double-resolution tiles)
39-
restart: unless-stopped
39+
volumes:
40+
- ./cache:/opt/facilmap/cache
41+
restart: always
4042
mariadb:
4143
image: mariadb
4244
environment:
@@ -47,7 +49,7 @@ services:
4749
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
4850
healthcheck:
4951
test: healthcheck.sh --su-mysql --connect --innodb_initialized
50-
restart: unless-stopped
52+
restart: always
5153
```
5254
5355
Here is an example with Postgres:
@@ -76,7 +78,9 @@ services:
7678
MAXMIND_USER_ID: # Sign up here https://www.maxmind.com/en/geolite2/signup (needed for geoip lookup to show initial map state)
7779
MAXMIND_LICENSE_KEY:
7880
LIMA_LABS_TOKEN: # Get an API key on https://maps.lima-labs.com/ (optional, needed for double-resolution tiles)
79-
restart: unless-stopped
81+
volumes:
82+
- ./cache:/opt/facilmap/cache
83+
restart: always
8084
postgres:
8185
image: postgis/postgis
8286
environment:
@@ -85,7 +89,7 @@ services:
8589
POSTGRES_DB: facilmap
8690
healthcheck:
8791
test: pg_isready -d $$POSTGRES_DB
88-
restart: unless-stopped
92+
restart: always
8993
```
9094
9195
To start FacilMap, run `docker-compose up -d` in the directory of the `docker-compose.yml` file. To upgrade FacilMap, run `docker-compose pull` and then restart it by running `docker-compose up -d`.

entrypoint.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
3+
chown facilmap:facilmap "$CACHE_DIR"
4+
5+
exec su facilmap -c "$@"

0 commit comments

Comments
 (0)