Skip to content
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

Adds pyproject.toml using hatch and refactors dockerfile #5

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
89e4ce5
refactoring for hatch/pyproject.toml
fabricebrito Sep 25, 2024
8f87263
removes Jenkinsfile
fabricebrito Sep 25, 2024
f7c4f6a
first improvements
Sep 25, 2024
0e89939
toml fixes
Sep 25, 2024
81b66a0
explicit declaration of tests deps (pyyaml not found)
Sep 25, 2024
768a95c
Merge branch 'EOEPCA:hatch' into hatch
xmichele Sep 25, 2024
f9dec8c
canonical package.yaml with pypi api token reference
xmichele Sep 25, 2024
a81e6f4
Update package.yaml with trusted publishers vs api_token
xmichele Sep 25, 2024
1083b06
Update package.yaml for __token__ handling
xmichele Sep 25, 2024
11e07b9
new token
xmichele Sep 25, 2024
bef1969
skip_existing: true
xmichele Sep 25, 2024
9306653
disable trusted publishers based permissions
xmichele Sep 25, 2024
948c10d
going for straight upload
xmichele Sep 25, 2024
043a2ab
enable coverage computation in pyproject.toml
xmichele Sep 25, 2024
35b8e9b
Merge pull request #2 from xmichele/hatch
fabricebrito Sep 25, 2024
f3f390f
Dockerfile update
xmichele Sep 25, 2024
75c4dfc
Merge pull request #3 from xmichele/hatch
fabricebrito Sep 26, 2024
3eb6d66
tidy pyproject.toml
fabricebrito Sep 26, 2024
111a2f7
test ci package
fabricebrito Sep 26, 2024
312df60
CI add write
fabricebrito Sep 26, 2024
03e45f2
CI pypi if block
fabricebrito Sep 26, 2024
e1761ed
ci kebab-case
fabricebrito Sep 26, 2024
29c60e8
Update pyproject.toml with project.dependencies
xmichele Sep 26, 2024
8c06ba2
Update __init__.py for bump to 0.12.3
xmichele Sep 26, 2024
3a4b6d2
Merge pull request #4 from xmichele/hatch
fabricebrito Dec 3, 2024
307ec5d
adds yq
fabricebrito Dec 3, 2024
9a02c39
fixes type using outputbinding type
fabricebrito Dec 5, 2024
f2960df
bump version
fabricebrito Dec 5, 2024
abe8dce
outputBindingResult for stage-in and stage-out
fabricebrito Dec 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .binder/environment.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .binder/postBuild

This file was deleted.

26 changes: 0 additions & 26 deletions .devcontainer/Dockerfile

This file was deleted.

27 changes: 0 additions & 27 deletions .devcontainer/devcontainer.json

This file was deleted.

21 changes: 0 additions & 21 deletions .devcontainer/environment.yml

This file was deleted.

File renamed without changes.
41 changes: 41 additions & 0 deletions .github/workflows/package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish to PyPI

on:
push:
branches: [ "hatch" ] #main can be added
release:
types: [published]

permissions:
contents: read
id-token: write # Ensure this permission is available for trusted publishing

jobs:
deploy:
runs-on: ubuntu-latest
environment: release
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
- name: Install dependencies
run: pip install hatch
- name: Build package
run: hatch build
- name: Test package
run: hatch -e test run nose2 --verbose
- name: Publish package distributions to Test PyPI
if: github.ref != 'refs/heads/main'
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
repository-url: https://test.pypi.org/legacy/
- name: Publish package distributions to PyPI
if: github.ref == 'refs/heads/main'
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
repository-url: https://upload.pypi.org/legacy/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ build
*.pyc
.DS_Store
src/test.cwl
__pycache__
43 changes: 0 additions & 43 deletions .travis.yml

This file was deleted.

73 changes: 52 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,52 @@
FROM ubuntu:20.04

SHELL ["/bin/bash", "-c"]
ENV BASH_ENV=~/.bashrc \
MAMBA_ROOT_PREFIX=/opt/conda \
PATH=$PATH:/opt/conda/envs/env_cwl_wrapper/bin

# Install basic commands and mamba
RUN apt-get update && \
apt-get install -y ca-certificates wget bash bzip2 gcc linux-libc-dev libc6-dev curl && \
wget -qO- https://micromamba.snakepit.net/api/micromamba/linux-64/latest | tar -xvj bin/micromamba --strip-components=1 && \
./micromamba shell init -s bash -p ~/micromamba && \
apt-get clean autoremove --yes && \
rm -rf /var/lib/{apt,dpkg,cache,log} && \
cp ./micromamba /usr/bin

COPY . /tmp

RUN micromamba create -f /tmp/environment.yml && \
cd /tmp && \
/opt/conda/envs/env_cwl_wrapper/bin/python setup.py install
# Stage 1: Build stage
FROM rockylinux:9.3-minimal AS build

# Install necessary build tools & hatch
RUN microdnf install -y curl tar && \
curl -L https://github.com/pypa/hatch/releases/latest/download/hatch-x86_64-unknown-linux-gnu.tar.gz -o /tmp/hatch-x86_64-unknown-linux-gnu.tar.gz && \
tar -xzf /tmp/hatch-x86_64-unknown-linux-gnu.tar.gz -C /tmp/ && chmod +x /tmp/hatch

# Stage 2: Final stage
FROM rockylinux:9.3-minimal

# Install runtime dependencies
RUN microdnf install -y --nodocs nodejs wget && \
microdnf clean all

# install yq
RUN wget https://github.com/mikefarah/yq/releases/download/v4.44.5/yq_linux_amd64 -O /usr/bin/yq && \
chmod +x /usr/bin/yq


# Set up a default user and home directory
ENV HOME=/home/wrapper

# Create a user with UID 1001, group root, and a home directory
RUN useradd -u 1001 -r -g 0 -m -d ${HOME} -s /sbin/nologin \
-c "Default CWL Wrapper User" wrapper && \
mkdir -p /app && \
mkdir -p /prod && \
chown -R 1001:0 /app && \
chmod g+rwx ${HOME} /app

# Copy the hatch binary from the build stage
COPY --from=build /tmp/hatch /usr/bin/hatch

# Switch to the non-root user
USER wrapper

# Copy the application files into the /app directory
COPY --chown=1001:0 . /app
WORKDIR /app

# Set up virtual environment paths
ENV VIRTUAL_ENV=/app/envs/wrapper
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

# Prune any existing environments and create a new production environment
RUN hatch env prune && \
hatch env create prod && \
rm -fr /tmp/* /app/.git /app/.pytest_cache

# Set the default command to run when the container starts
CMD ["bash", "-c", "source /app/envs/wrapper/bin/activate && cwl-wrapper"]
56 changes: 0 additions & 56 deletions Jenkinsfile

This file was deleted.

13 changes: 0 additions & 13 deletions TODO

This file was deleted.

12 changes: 0 additions & 12 deletions environment.yml

This file was deleted.

37 changes: 0 additions & 37 deletions meta.yaml

This file was deleted.

Loading
Loading