Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: missing tmp directory in production image #14

Merged
merged 3 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ RUN pip install --no-cache-dir "uvicorn[standard]==0.30.1"

WORKDIR /reference

# Make sure we have a temporary directory in the container, although ideally one should
# be mounted in so it's not stored on the overlay FS.
RUN mkdir -p tmp

COPY pyproject.toml .
COPY poetry.lock .

Expand All @@ -18,11 +22,13 @@ RUN poetry config virtualenvs.create false && \
# Manually copy only what's relevant
# (Don't use .dockerignore, which allows us to have development containers too)
COPY bento_reference_service bento_reference_service
COPY entrypoint.bash .
COPY run.bash .
COPY LICENSE .
COPY README.md .

# Install the module itself, locally (similar to `pip install -e .`)
RUN poetry install --without dev

ENTRYPOINT [ "bash", "./entrypoint.bash" ]
CMD [ "bash", "./run.bash" ]
14 changes: 14 additions & 0 deletions entrypoint.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

source /create_service_user.bash

# Set up Git configuration if needed (useful for development images / containers)
gosu bento_user /bin/bash -c '/set_gitconfig.bash'

# Addition to base entrypoint: fix default production temporary folder permissions
if [[ -d '/reference/tmp' ]]; then
chown -R bento_user:bento_user '/reference/tmp'
fi

# Drop into bento_user from root and execute the CMD specified for the image
exec gosu bento_user "$@"
Loading