Skip to content

Commit

Permalink
Merge pull request #14 from bento-platform/fix/prod-entrypoint
Browse files Browse the repository at this point in the history
fix: missing tmp directory in production image
  • Loading branch information
davidlougheed authored Jun 3, 2024
2 parents 887d38a + b7ae6dc commit 00a98e8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
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 "$@"

0 comments on commit 00a98e8

Please sign in to comment.