From ee57f56e2be10d1ab62d9d340325494beead29ca Mon Sep 17 00:00:00 2001 From: lkstrp Date: Thu, 28 Nov 2024 17:59:15 +0100 Subject: [PATCH] ci: add dev image deployment --- .github/workflows/deploy-dev-images.yaml | 27 ++++++++++++++++++++++++ docker/dev-env/Dockerfile | 26 +++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 .github/workflows/deploy-dev-images.yaml create mode 100644 docker/dev-env/Dockerfile diff --git a/.github/workflows/deploy-dev-images.yaml b/.github/workflows/deploy-dev-images.yaml new file mode 100644 index 000000000..ee5ca2804 --- /dev/null +++ b/.github/workflows/deploy-dev-images.yaml @@ -0,0 +1,27 @@ +name: Deploy dev-env image + +on: + push: + paths: + - envs/linux-pinned.yaml + workflow_dispatch: + +jobs: + push-image: + name: Push dev-env image + runs-on: ubuntu-latest + steps: + - name: 'Checkout GitHub Action' + uses: actions/checkout@main + + - name: 'Login to GitHub Container Registry' + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.REGISTRY_TOKEN }} + + - name: 'Build Inventory Image' + run: | + docker build . --tag ghcr.io/${{ github.repository_owner }}/eur-dev-env:latest --file docker/dev-env/Dockerfile + docker push ghcr.io/${{ github.repository_owner }}/eur-dev-env:latest diff --git a/docker/dev-env/Dockerfile b/docker/dev-env/Dockerfile new file mode 100644 index 000000000..87ee95a6a --- /dev/null +++ b/docker/dev-env/Dockerfile @@ -0,0 +1,26 @@ +FROM condaforge/mambaforge + +RUN conda update -n base conda +RUN conda install -n base conda-libmamba-solver +RUN conda config --set solver libmamba + +RUN apt-get update && apt-get install -y bash git make + +RUN conda --version + +WORKDIR /pypsa-eur + +COPY ./envs ./temp + +RUN conda env create -n pypsa-eur -f temp/environment.yaml +RUN conda init bash +RUN echo "conda activate pypsa-eur" >> ~/.bashrc + +SHELL ["/bin/bash", "--login", "-c"] +ENV PATH=/opt/conda/envs/pypsa-eur/bin:$PATH + +RUN rm -r temp +RUN conda clean -afy && \ + rm -rf /tmp/* + +CMD ["bash"]