Repository navigation
fix(docker): run the test image as a non-root user #46
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,34 @@ | ||
| ARG PYTHON_VERSION=3.10 | ||
| FROM python:${PYTHON_VERSION}-slim | ||
|
|
||
| RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
| libsodium23 \ | ||
| wget \ | ||
| build-essential \ | ||
| libffi-dev \ | ||
| curl \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
| COPY --from=ghcr.io/astral-sh/uv:0.13.4 /uv /uvx /bin/ | ||
|
|
||
| RUN useradd --create-home --uid 10001 app \ | ||
| && mkdir /app \ | ||
| && chown app:app /app | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| ENV PIP_NO_CACHE_DIR=false \ | ||
| PIP_DISABLE_PIP_VERSION_CHECK=on \ | ||
| ENV PIP_DISABLE_PIP_VERSION_CHECK=on \ | ||
| PIP_DEFAULT_TIMEOUT=10 \ | ||
| PYTHONUNBUFFERED=1 \ | ||
| PYTHONDONTWRITEBYTECODE=1 | ||
|
|
||
| RUN pip install uv | ||
| USER 10001 | ||
|
|
||
| COPY pyproject.toml uv.lock* README.md /app/ | ||
| COPY --chown=app:app pyproject.toml uv.lock* README.md /app/ | ||
|
|
||
| RUN uv sync --extra dev | ||
|
|
||
| ENV PATH="/app/.venv/bin:$PATH" | ||
|
|
||
| COPY tornadoapi_guard/ /app/tornadoapi_guard/ | ||
| COPY tests/ /app/tests/ | ||
| COPY examples/ /app/examples/ | ||
| COPY docs/ /app/docs/ | ||
| COPY --chown=app:app tornadoapi_guard/ /app/tornadoapi_guard/ | ||
| COPY --chown=app:app tests/ /app/tests/ | ||
| COPY --chown=app:app examples/ /app/examples/ | ||
| COPY --chown=app:app docs/ /app/docs/ | ||
|
|
||
| RUN mkdir -p /app/data/ipinfo | ||
|
|
||
| # Probes the app service on port 8000. Any HTTP answer counts as alive; a refused connection or a timeout fails. | ||
| HEALTHCHECK --interval=10s --timeout=5s --start-period=20s --retries=3 \ | ||
| CMD ["python", "-c", "import urllib.request, urllib.error\ntry:\n urllib.request.urlopen('http://127.0.0.1:8000/', timeout=3)\nexcept urllib.error.HTTPError:\n pass"] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.