Skip to content

Commit

Permalink
Merge pull request #77 from crosenth/master
Browse files Browse the repository at this point in the history
Added some unittests
  • Loading branch information
crosenth authored Aug 29, 2024
2 parents fe8b580 + 957bf3e commit f10602d
Show file tree
Hide file tree
Showing 10 changed files with 338 additions and 276 deletions.
31 changes: 29 additions & 2 deletions .github/workflows/docker-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@ name: Build and push docker image for pipeline

on:
push:
tags: [ '*.*.*' ]
branches:
- "*"
tags:
- "*.*.*"
schedule:
- cron: '0 6 15 * *' # 15th of each month at 6am

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build_pipeline_image:
build_and_test_pipeline_image:
runs-on: ubuntu-latest

steps:
Expand All @@ -29,9 +34,31 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build image
uses: docker/build-push-action@v6
with:
annotations: ${{ steps.meta.outputs.annotations }}
build-args: |
MEFETCH_EMAIL=${{ secrets.MEFETCH_EMAIL }}
MEFETCH_API_KEY=${{ secrets.MEFETCH_API_KEY }}
YA16SDB_VERSION=${{ steps.meta.outputs.version }}
cache-from: type=gha
cache-to: type=gha,mode=max
labels: ${{ steps.meta.outputs.labels }}
load: true
push: false
tags: |
${{ steps.meta.outputs.tags }}
gha_image
- name: Test run and unnitests
run: docker run gha_image /bin/bash -c "scons settings=testfiles/settings.conf;python -m unittest"

- name: Build and push tag
if: github.ref_type == 'tag'
uses: docker/build-push-action@v6
with:
annotations: ${{ steps.meta.outputs.annotations }}
cache-from: type=gha
cache-to: type=gha,mode=max
labels: ${{ steps.meta.outputs.labels }}
Expand Down
37 changes: 17 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
FROM python:3.11-bookworm

RUN apt-get update && apt-get upgrade -y && apt-get install --assume-yes --no-install-recommends \
ca-certificates git wget

ADD requirements.txt /usr/local/share/ya16sdb/
ADD bin/bootstrap.sh /usr/local/share/ya16sdb/bin/

ARG MEFETCH_API_KEY MEFETCH_EMAIL YA16SDB_VERSION

Check warning on line 2 in Dockerfile

View workflow job for this annotation

GitHub Actions / build_and_test_pipeline_image

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "MEFETCH_API_KEY") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

Check warning on line 2 in Dockerfile

View workflow job for this annotation

GitHub Actions / build_and_test_pipeline_image

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "MEFETCH_API_KEY") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

Check warning on line 2 in Dockerfile

View workflow job for this annotation

GitHub Actions / build_and_test_pipeline_image

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "MEFETCH_API_KEY") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

Check warning on line 2 in Dockerfile

View workflow job for this annotation

GitHub Actions / build_and_test_pipeline_image

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "MEFETCH_API_KEY") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/
ENV \

Check warning on line 3 in Dockerfile

View workflow job for this annotation

GitHub Actions / build_and_test_pipeline_image

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "MEFETCH_API_KEY") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

Check warning on line 3 in Dockerfile

View workflow job for this annotation

GitHub Actions / build_and_test_pipeline_image

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "MEFETCH_API_KEY") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

Check warning on line 3 in Dockerfile

View workflow job for this annotation

GitHub Actions / build_and_test_pipeline_image

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "MEFETCH_API_KEY") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

Check warning on line 3 in Dockerfile

View workflow job for this annotation

GitHub Actions / build_and_test_pipeline_image

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "MEFETCH_API_KEY") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/
MEFETCH_API_KEY=${MEFETCH_API_KEY} \
MEFETCH_EMAIL=${MEFETCH_EMAIL} \
PIP_ROOT_USER_ACTION=ignore \
SCONSFLAGS="--file /usr/local/share/ya16sdb/SConstruct" \
YA16SDB_VERSION=${YA16SDB_VERSION}
RUN apt-get update && apt-get upgrade -y && apt-get install -y ca-certificates wget
WORKDIR /usr/local/share/ya16sdb/
RUN ["/bin/bash", "-c", "bin/bootstrap.sh /usr/local/"]

ADD .git/ /usr/local/share/ya16sdb/.git/
ADD data/ /usr/local/share/ya16sdb/data/
ADD bin/ /usr/local/share/ya16sdb/bin/
ADD SConstruct ncbi.conf /usr/local/share/ya16sdb/

RUN find /usr/local/share/ya16sdb/ -type f -exec chmod 644 {} \; && \
find /usr/local/share/ya16sdb/ -type d -exec chmod 755 {} \; && \
find /usr/local/share/ya16sdb/bin/ -type f -exec chmod 755 {} \;

ENV SCONSFLAGS="--file /usr/local/share/ya16sdb/SConstruct"

COPY requirements.txt SConstruct ncbi.conf ./
COPY testfiles/ ./testfiles/
COPY tests/ ./tests/
COPY bin/ ./bin/
COPY data/ ./data/
RUN bin/bootstrap.sh /usr/local/
RUN find . -type f -exec chmod 644 {} \; && \
find . -type d -exec chmod 755 {} \; && \
find ./bin/ -type f -exec chmod 755 {} \;
CMD ["scons", "--dry-run"]
Loading

0 comments on commit f10602d

Please sign in to comment.