From cd033e99e5291d01b1f18322c2cc3124f55a34a8 Mon Sep 17 00:00:00 2001 From: Harrison Deng Date: Mon, 24 Feb 2025 17:52:21 +0000 Subject: [PATCH] Changed devcontainer --- .devcontainer/Dockerfile | 16 ++++++++++++++++ .devcontainer/devcontainer.json | 12 +++++++----- .devcontainer/noop.txt | 3 +++ Jenkinsfile | 3 +-- environment.yml | 7 +++++++ 5 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/noop.txt create mode 100644 environment.yml diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..808f11b --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,16 @@ +FROM mcr.microsoft.com/devcontainers/miniconda:1-3 + +# Copy environment.yml (if found) to a temp location so we update the environment. Also +# copy "noop.txt" so the COPY instruction does not fail if no environment.yml exists. +COPY environment.yml* .devcontainer/noop.txt /tmp/conda-tmp/ +RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \ + && rm -rf /tmp/conda-tmp + +# [Optional] Uncomment to install a different version of Python than the default +# RUN conda install -y python=3.6 \ +# && pip install --no-cache-dir pipx \ +# && pipx reinstall-all + +# [Optional] Uncomment this section to install additional OS packages. +# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ +# && apt-get -y install --no-install-recommends diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index ce3acb4..43d26c5 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,9 +1,11 @@ // For format details, see https://aka.ms/devcontainer.json. For config options, see the -// README at: https://github.com/devcontainers/templates/tree/main/src/python +// README at: https://github.com/devcontainers/templates/tree/main/src/miniconda { - "name": "Python 3", - // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile - "image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye", + "name": "Miniconda (Python 3)", + "build": { + "context": "..", + "dockerfile": "Dockerfile" + } // Features to add to the dev container. More info: https://containers.dev/features. // "features": {}, @@ -12,7 +14,7 @@ // "forwardPorts": [], // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "pip3 install --user -r requirements.txt" + // "postCreateCommand": "python --version", // Configure tool-specific properties. // "customizations": {}, diff --git a/.devcontainer/noop.txt b/.devcontainer/noop.txt new file mode 100644 index 0000000..abee195 --- /dev/null +++ b/.devcontainer/noop.txt @@ -0,0 +1,3 @@ +This file is copied into the container along with environment.yml* from the +parent folder. This is done to prevent the Dockerfile COPY instruction from +failing if no environment.yml is found. \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index adf8824..9f3b18a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,11 +10,10 @@ pipeline { stages { stage ("install") { steps { - sh 'conda install python==3.12.7 pip -y -q' + sh 'conda env update -n base --file environment.yml' sh 'useradd galaxy -m' sh 'apt-get update' sh 'apt-get install sudo -y' - sh 'pip install -r requirements.txt' } } stage ("lint") { diff --git a/environment.yml b/environment.yml new file mode 100644 index 0000000..7d21ca9 --- /dev/null +++ b/environment.yml @@ -0,0 +1,7 @@ +name: base +channels: + - bioconda + - conda-forge +dependencies: + - python==3.12 + - planemo \ No newline at end of file