-
Notifications
You must be signed in to change notification settings - Fork 21
v2.3.0 #318
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
v2.3.0 #318
Changes from 19 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
3b6ce15
Update docker/login-action action to v4
7124e0c
Update docker/setup-buildx-action action to v4
cf98c44
feat: multi-stage build without uv runtime dependency
rtuszik 1e6825f
increase test coverage
rtuszik 79fcf19
single region jsonl implementation
rtuszik 0cbf919
jsonl e2e test
rtuszik ae0729d
feat: add multi-region JSONL support with country codes
rtuszik 94999f5
fix: prevent serving empty index after a failed JSONL import
rtuszik d959484
ci: use uv native caching, pin to .python-version file
rtuszik 53d2f68
chore(deps): update dependency pytest to v9.0.3 [security]
koalabot-rt[bot] 827ffaf
refactor: split filesystem/updater into index and update modules
rtuszik a5da3c8
fix: index marker scope
rtuszik 04a1106
refactor(import): rename import marker functions for clarity
rtuszik a83c2e5
refactor: standardize ruff config and make args keyword-only
rtuszik 7a8a9d6
Update Photon version to 1.2.0
rtuszik b062d85
fix: correct continent country-code slices and harden update recovery
rtuszik 56032fc
feat: checksum retry, move before extraction, add notification
rtuszik fd75833
docs(README): update index info, add import mode and env vars
rtuszik 50fbd41
chore: uv lock update
rtuszik af6f7fb
Update .github/workflows/full-test-jsonl.yml
rtuszik 85e611e
ci: update lint workflow and fix README badges and typos
rtuszik 70264b8
ci(github-actions): add read permissions and use env vars in summary
rtuszik e8581cc
refactor(update): ensure temp directory cleared on failure
rtuszik 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 |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| name: Container Test | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| - dev | ||
| paths: | ||
| - "Dockerfile" | ||
| - "src/**" | ||
| - "docker-compose*.yml" | ||
| - ".last_release" | ||
| - "pyproject.toml" | ||
| - "uv.lock" | ||
|
|
||
| jobs: | ||
| test-container-jsonl: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4 | ||
|
|
||
| - name: Read Photon version from .last_release | ||
| id: photon_version | ||
| run: | | ||
| PHOTON_VERSION=$(cat .last_release | tr -d '[:space:]') | ||
| if [[ -z "$PHOTON_VERSION" || ! "$PHOTON_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
| echo "Error: .last_release is missing, empty, or contains an invalid version: '$PHOTON_VERSION'" | ||
| exit 1 | ||
| fi | ||
| echo "PHOTON_VERSION=$PHOTON_VERSION" >> "$GITHUB_ENV" | ||
| echo "Photon Version: $PHOTON_VERSION" | ||
|
|
||
| - name: Build test image | ||
| uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7 | ||
| with: | ||
| context: . | ||
| file: ./Dockerfile | ||
| build-args: | | ||
| PHOTON_VERSION=${{ env.PHOTON_VERSION }} | ||
| push: false | ||
| load: true | ||
| tags: photon-test:pr-${{ github.event.pull_request.number }} | ||
| platforms: linux/amd64 | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
|
|
||
| - name: Start container | ||
| run: | | ||
| docker run -d \ | ||
| --name photon-test-pr-${{ github.event.pull_request.number }} \ | ||
| -e REGION=andorra \ | ||
| -e IMPORT_MODE=jsonl \ | ||
| -e UPDATE_STRATEGY=DISABLED \ | ||
| photon-test:pr-${{ github.event.pull_request.number }} | ||
|
|
||
| - name: Wait for container to be healthy | ||
| run: | | ||
| echo "Waiting for container to become healthy (timeout: 6 minutes)..." | ||
| CONTAINER_NAME=photon-test-pr-${{ github.event.pull_request.number }} | ||
|
|
||
| docker logs -f $CONTAINER_NAME & | ||
| LOGS_PID=$! | ||
|
|
||
| SECONDS=0 | ||
| TIMEOUT=360 | ||
|
|
||
| while [ $SECONDS -lt $TIMEOUT ]; do | ||
| HEALTH_STATUS=$(docker inspect --format='{{.State.Health.Status}}' $CONTAINER_NAME 2>/dev/null || echo "unknown") | ||
|
|
||
| if [ "$HEALTH_STATUS" = "healthy" ]; then | ||
| echo "Container is healthy after $SECONDS seconds" | ||
| kill $LOGS_PID 2>/dev/null || true | ||
| exit 0 | ||
| fi | ||
|
|
||
| echo "Health status: $HEALTH_STATUS (elapsed: ${SECONDS}s)" | ||
| sleep 10 | ||
| SECONDS=$((SECONDS + 10)) | ||
| done | ||
|
|
||
| kill $LOGS_PID 2>/dev/null || true | ||
| echo "Container failed to become healthy within $TIMEOUT seconds" | ||
| docker logs $CONTAINER_NAME | ||
| exit 1 | ||
|
|
||
| - name: Cleanup | ||
| if: always() | ||
| run: | | ||
| docker stop photon-test-pr-${{ github.event.pull_request.number }} || true | ||
| docker rm photon-test-pr-${{ github.event.pull_request.number }} || true | ||
| docker rmi photon-test:pr-${{ github.event.pull_request.number }} || true | ||
|
|
||
| - name: Output summary | ||
| if: always() | ||
| run: | | ||
| echo "## Container Test Summary" >> $GITHUB_STEP_SUMMARY | ||
| echo "- **PR Number:** ${{ github.event.pull_request.number }}" >> $GITHUB_STEP_SUMMARY | ||
| echo "- **Photon Version:** ${{ env.PHOTON_VERSION }}" >> $GITHUB_STEP_SUMMARY | ||
| echo "- **Status:** ${{ job.status }}" >> $GITHUB_STEP_SUMMARY | ||
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
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 +1 @@ | ||
| 1.1.0 | ||
| 1.2.0 |
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,20 +1,40 @@ | ||
| FROM eclipse-temurin:21.0.9_10-jre-noble | ||
| FROM ubuntu:noble AS builder | ||
|
|
||
| ARG DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| RUN apt-get update \ | ||
| && apt-get -y install --no-install-recommends \ | ||
| python3.12 \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # install astral uv | ||
| COPY --from=ghcr.io/astral-sh/uv:0.10 /uv /usr/local/bin/ | ||
|
|
||
| WORKDIR /build | ||
|
|
||
| COPY pyproject.toml uv.lock ./ | ||
|
|
||
| ENV UV_PYTHON=/usr/bin/python3.12 \ | ||
| UV_PYTHON_PREFERENCE=only-system \ | ||
| UV_LINK_MODE=copy \ | ||
| UV_PROJECT_ENVIRONMENT=/photon/.venv | ||
|
|
||
| RUN uv sync --locked --no-dev --no-install-project | ||
|
|
||
|
|
||
| FROM eclipse-temurin:21.0.9_10-jre-noble | ||
|
|
||
| ARG DEBIAN_FRONTEND=noninteractive | ||
| ARG PHOTON_VERSION | ||
| ARG PUID=9011 | ||
| ARG PGID=9011 | ||
|
|
||
| RUN apt-get update \ | ||
| && apt-get -y install --no-install-recommends \ | ||
| lbzip2 \ | ||
| gosu \ | ||
| python3.12 \ | ||
| curl \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
| && apt-get -y install --no-install-recommends \ | ||
| lbzip2 \ | ||
| gosu \ | ||
| python3.12 \ | ||
| curl \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| RUN groupadd -g ${PGID} -o photon && \ | ||
| useradd -l -u ${PUID} -g photon -o -s /bin/false -m -d /photon photon | ||
|
|
@@ -27,24 +47,24 @@ ADD https://github.com/komoot/photon/releases/download/${PHOTON_VERSION}/photon- | |
|
|
||
| COPY src/ ./src/ | ||
| COPY entrypoint.sh . | ||
| COPY pyproject.toml . | ||
| COPY uv.lock . | ||
| RUN gosu photon uv sync --locked | ||
| COPY --from=builder /photon/.venv /photon/.venv | ||
|
|
||
| ENV PATH="/photon/.venv/bin:${PATH}" \ | ||
| VIRTUAL_ENV=/photon/.venv | ||
|
|
||
| RUN chmod 644 /photon/photon.jar && \ | ||
| chown -R photon:photon /photon | ||
|
|
||
| LABEL org.opencontainers.image.title="photon-docker" \ | ||
| org.opencontainers.image.description="Unofficial docker image for the Photon Geocoder" \ | ||
| org.opencontainers.image.url="https://github.com/rtuszik/photon-docker" \ | ||
| org.opencontainers.image.source="https://github.com/rtuszik/photon-docker" \ | ||
| org.opencontainers.image.documentation="https://github.com/rtuszik/photon-docker#readme" | ||
| org.opencontainers.image.description="Unofficial docker image for the Photon Geocoder" \ | ||
| org.opencontainers.image.url="https://github.com/rtuszik/photon-docker" \ | ||
| org.opencontainers.image.source="https://github.com/rtuszik/photon-docker" \ | ||
| org.opencontainers.image.documentation="https://github.com/rtuszik/photon-docker#readme" | ||
|
|
||
| EXPOSE 2322 | ||
|
|
||
| HEALTHCHECK --interval=30s --timeout=10s --start-period=240s --retries=3 \ | ||
| CMD curl -f http://localhost:2322/status || exit 1 | ||
| CMD curl -f http://localhost:2322/status || exit 1 | ||
|
|
||
| ENTRYPOINT ["/bin/sh", "entrypoint.sh"] | ||
| CMD ["uv", "run", "-m", "src.process_manager"] | ||
| CMD ["/photon/.venv/bin/python", "-m", "src.process_manager"] | ||
|
Comment on lines
69
to
+70
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win Run the final container as the non-root user. The runtime image still executes as root because the final stage never switches user. Add Suggested patch RUN chmod 644 /photon/photon.jar && \
chown -R photon:photon /photon
+
+USER photon
LABEL org.opencontainers.image.title="photon-docker" \Source: Linters/SAST tools |
||
Oops, something went wrong.
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.