Merge pull request #27 from DustyPullRequest/patch-1

BUGFIX: Fixed permissions error when attempting write to /app/memory.json
This commit is contained in:
Tim Jaeryang Baek 2025-04-08 02:30:46 -07:00 committed by GitHub
commit 25d88f8db9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 0 deletions

View File

@ -9,9 +9,13 @@ services:
context: ./servers/memory context: ./servers/memory
ports: ports:
- 8082:8000 - 8082:8000
volumes:
- memory:/app/data:rw
time-server: time-server:
build: build:
context: ./servers/time context: ./servers/time
ports: ports:
- 8083:8000 - 8083:8000
volumes:
memory:

View File

@ -38,6 +38,12 @@ RUN --mount=type=cache,target=/root/.cache/pip \
--mount=type=bind,source=requirements.txt,target=requirements.txt \ --mount=type=bind,source=requirements.txt,target=requirements.txt \
python -m pip install -r requirements.txt python -m pip install -r requirements.txt
# Change the ownership of /app/data directory and its contents to appuser
RUN mkdir -p /app/data && touch /app/data/memory.json && chown -R ${UID}:${UID} /app/data
# Set a flag for the location of the database
ENV MEMORY_FILE_PATH="/app/data/memory.json"
# Switch to the non-privileged user to run the application. # Switch to the non-privileged user to run the application.
USER appuser USER appuser

View File

@ -4,4 +4,9 @@ services:
context: . context: .
ports: ports:
- 8000:8000 - 8000:8000
volumes:
- memory:/app/data:rw
volumes:
memory: