Skip to content

Commit

Permalink
feat: add Dockerfile (#10)
Browse files Browse the repository at this point in the history
* feat: add Dockerfile (#6)

* feat: update ci with docker #6
  • Loading branch information
balajtimate authored Oct 16, 2023
1 parent d766ebd commit 135758a
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*
!scRNAsim_toolz/
!tests/
!setup.py
!requirements.txt
!environment.yml
!LICENSE
!README.md
38 changes: 37 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,40 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
verbose: true
fail_ci_if_error: false
fail_ci_if_error: false

publish:
name: build and publish app image
runs-on: ubuntu-latest
if: |
github.event_name == 'push' &&
github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
steps:

- name: check out repository
uses: actions/checkout@v4

- name: generate tag
run: |
echo "TAG=$(date '+%Y%m%d')" >> $GITHUB_ENV
- name: build and publish image
id: docker
uses: philips-software/[email protected]
with:
dockerfile: .
image-name: "scrnasim-toolz"
tags: "latest ${{ env.TAG }}"
push-branches: "${{ github.event.repository.default_branch }}"
env:
REGISTRY_USERNAME: ${{ secrets.DOCKERHUB_LOGIN }}
REGISTRY_TOKEN: "${{ secrets.DOCKERHUB_TOKEN }}"
DOCKER_ORGANIZATION: ${{ secrets.DOCKERHUB_ORG }}
GITHUB_ORGANIZATION: ${{ github.repository_owner }}

- name: Verify that image was pushed
run: |
echo "Push indicator: ${{ steps.docker.outputs.push-indicator }}"
echo "# Set to 'true' if image was pushed, empty string otherwise"
test "${{ steps.docker.outputs.push-indicator }}" == "true"
39 changes: 39 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
###### BASE IMAGE ######
FROM continuumio/miniconda3:4.12.0

####### METADATA #######
LABEL base_image="continuumio/miniconda3:4.12.0"
LABEL version="1.0"
LABEL software="scRNAsim-toolz"
LABEL software.version="v0.1.1"
LABEL about.home="https://github.com/zavolanlab/scRNAsim-toolz"

###### MAINTAINER ######
LABEL maintainer="Máté Balajti <[email protected]>"

##### INSTALLATION #####

# COPY THE YAML & INSTALL SOFTWARE WITH CONDA
WORKDIR /usr/src/app
COPY ./ ./
RUN conda env create --file environment.yml

# VARIABLES
ARG WORKDIR="/home/USER"
ARG USER="USER"
ARG GROUP="GROUP"
ENV PATH="${WORKDIR}:${PATH}"

# CREATE USER
RUN groupadd -r ${GROUP} && useradd --no-log-init -r -g ${GROUP} ${USER}

# SET ENVIRONMENT
WORKDIR ${WORKDIR}
RUN chown -R ${USER}:${GROUP} ${WORKDIR} && chmod 700 ${WORKDIR}
USER ${USER}
RUN echo "source activate scrnasim" > ~/.bashrc
ENV PATH /opt/conda/envs/scrnasim/bin:$PATH

# SET ENTRYPOINT
ENTRYPOINT ["transcript-sampler"]
CMD ["-v"]
2 changes: 0 additions & 2 deletions environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@ dependencies:
- mypy
- pylint
- pytest
- pip:
- -e .
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ channels:
- conda-forge
- bioconda
dependencies:
- pip>=20.2.3
- biopython>=1.78
- polars==0.16.17
- gtfparse
- numpy>=1.23.3
- nextflow
- pandas>=1.4.4
- pip>=20.2.3
- python>=3.6, <=3.10
- pyarrow
- pip:
Expand Down
43 changes: 43 additions & 0 deletions pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
### Description

Please include a summarized description of the change(s) and which issue(s)
this pull request addresses, if any. Please include relevant motivation and
context, unless already duly described in an associated issue or resource.
Make sure to list any dependencies that are required for this change.

Fixes # (issue)

### Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality
to not work as expected)
- [ ] Documentation update

### Checklist

Please carefully read these items and tick them off if the statements are true
_or do not apply_.

- [ ] I have performed a self-review of my own code
- [ ] My code follows the existing coding style, lints and generates no new
warnings
- [ ] I have added type annotations to all function/method signatures, and I
have added type annotations for any local variables that are non-trivial,
potentially ambiguous or might otherwise benefit from explicit typing.
- [ ] I have commented my code in hard-to-understand areas
- [ ] I have added ["Google-style docstrings"] to all new modules, classes,
methods/functions or updated previously existing ones
- [ ] I have added tests that prove my fix is effective or that my feature
works
- [ ] New and existing unit tests pass locally with my changes and I have not
reduced the code coverage relative to the previous state
- [ ] I have updated any sections of the app's documentation that are affected
by the proposed changes

If for some reason you are unable to tick off all boxes, please leave a
comment explaining the issue you are facing so that we can work on it
together.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ pandas>=1.4.4
polars==0.16.17
gtfparse
setuptools
cli_test_helpers
pyarrow
cli_test_helpers

0 comments on commit 135758a

Please sign in to comment.