From dcd96ed5d1b30b94087a5b1d514ba4036928f2a5 Mon Sep 17 00:00:00 2001 From: Luchesar ILIEV Date: Sat, 13 Jul 2024 17:35:58 +0300 Subject: [PATCH] ops: enable building on x-calib-nopeak-find --- .github/workflows/ci.yml | 38 +++++++++++++++++++++++++++++--------- Dockerfile | 17 +++-------------- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 01b8fe7..bbbac15 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,10 +6,13 @@ on: # yamllint disable-line rule:truthy branches: - main - develop + - x-calib-nopeak-find pull_request: branches: - main - develop + tags: + - v*.*.* workflow_dispatch: env: @@ -34,7 +37,7 @@ jobs: steps: - name: Checkout the repository - uses: actions/checkout@v4.1.6 + uses: actions/checkout@v4.1.7 - name: Setup Python uses: actions/setup-python@v5.1.0 @@ -74,6 +77,8 @@ jobs: run: >- if [[ $GITHUB_REF == refs/heads/main ]]; then SKIP=no-commit-to-branch poetry run pre-commit run --all-files + elif [[ $GITHUB_REF == refs/heads/x-calib-nopeak-find ]]; then + echo 'Skipping pre-commit.' else poetry run pre-commit run --all-files fi @@ -81,10 +86,16 @@ jobs: - name: Run tests env: COVERAGE_FILE: .coverage.${{ matrix.python-version }} - run: poetry run pytest --cov + run: >- + if [[ $GITHUB_REF == refs/heads/x-calib-nopeak-find ]]; then + echo 'Skipping tests.' + else + poetry run pytest --cov + fi - name: Store the coverage report uses: actions/upload-artifact@v4.3.3 + if: github.ref != 'refs/heads/x-calib-nopeak-find' with: name: coverage-${{ matrix.python-version }} path: .coverage.${{ matrix.python-version }} @@ -93,6 +104,7 @@ jobs: runs-on: ubuntu-latest needs: test + if: github.ref != 'refs/heads/x-calib-nopeak-find' permissions: pull-requests: write contents: write @@ -111,7 +123,7 @@ jobs: - name: Process the coverage reports id: coverage_processing - uses: py-cov-action/python-coverage-comment-action@v3.23 + uses: py-cov-action/python-coverage-comment-action@v3.25 with: COVERAGE_DATA_BRANCH: 'COVERAGE-REPORT' GITHUB_TOKEN: ${{ github.token }} @@ -136,8 +148,9 @@ jobs: id-token: write steps: + - name: Checkout repository - uses: actions/checkout@v4.1.6 + uses: actions/checkout@v4.1.7 # Install the cosign tool except on PR # https://github.com/sigstore/cosign-installer @@ -168,8 +181,15 @@ jobs: uses: docker/metadata-action@v5.5.1 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + labels: | + org.opencontainers.image.description=Spectra Search Interface + org.opencontainers.image.licenses=MIT + org.opencontainers.image.source=https://github.com/h2020charisma/spectrasearch + org.opencontainers.image.title=spectra-search + org.opencontainers.image.url=https://github.com/h2020charisma/spectrasearch/blob/main/README.md + org.opencontainers.image.vendor=IDEAconsult tags: | - type=raw,value=latest,enable=${{ github.ref == 'refs/heads/develop' }} + type=raw,value=latest,enable=${{ github.ref == 'refs/heads/x-calib-nopeak-find' }} type=raw,value=stable,enable=${{ github.ref == 'refs/heads/main' }} type=ref,event=branch type=ref,event=tag @@ -179,14 +199,14 @@ jobs: # https://github.com/docker/build-push-action - name: Build and push Docker image id: build-and-push - uses: docker/build-push-action@v5.3.0 + uses: docker/build-push-action@v6.2.0 with: + cache-from: type=gha + cache-to: type=gha,mode=max context: . + labels: ${{ steps.meta.outputs.labels }} push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max # Sign the resulting Docker image digest except on PRs. # This will only write to the public Rekor transparency log when the Docker diff --git a/Dockerfile b/Dockerfile index 0e37506..3e027dc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.12-slim as requirements-stage +FROM python:3.12-slim AS requirements-stage WORKDIR /tmp @@ -10,17 +10,6 @@ RUN poetry export -f requirements.txt --output requirements.txt --without=dev -- FROM python:3.12-slim -LABEL maintainer="Luchesar ILIEV " \ - org.opencontainers.image.created=$BUILD_DATE \ - org.opencontainers.image.description="A web-based spectra harmonization tool" \ - org.opencontainers.image.revision=$VCS_REF \ - org.opencontainers.image.schema-version="1.0" \ - org.opencontainers.image.source="https://github.com/h2020charisma/spectrastream" \ - org.opencontainers.image.title="spectrastream" \ - org.opencontainers.image.url="https://github.com/h2020charisma/spectrastream/blob/main/README.md" \ - org.opencontainers.image.vendor="IDEAconsult" \ - org.opencontainers.image.version="latest" - RUN apt-get update && apt-get install -y \ curl \ && rm -rf /var/lib/apt/lists/* @@ -31,7 +20,7 @@ RUN sed -i 's/^-e //' /tmp/requirements.txt \ && pip install --no-cache-dir --upgrade -r /tmp/requirements.txt \ && rm /tmp/requirements.txt -COPY ./src/spectrastream /app +COPY ./src /app WORKDIR /app @@ -39,4 +28,4 @@ EXPOSE 8501 HEALTHCHECK CMD curl --fail http://127.0.0.1:8501/_stcore/health -ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"] +ENTRYPOINT ["streamlit", "run", "streamlit_app.py", "--server.address=0.0.0.0", "--server.port=8501", "--server.baseUrlPath=/stream"]