-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b64623d
commit c77f716
Showing
8 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. | ||
{ | ||
"name": "pypsa earth dev", | ||
"image": "ghcr.io/drifter089/pypsa-earth:latest", | ||
"workspaceMount": "source=${localWorkspaceFolder},target=/workspaces,type=bind,consistency=cached", | ||
"initializeCommand": "docker pull ghcr.io/drifter089/pypsa-earth:latest", | ||
"workspaceFolder": "/workspaces", | ||
"postAttachCommand": "bash .devcontainer/setup.sh" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
|
||
# mv ../pypsa-eur/* ./ | ||
# echo 'solved tutorial files are copied to workspace' | ||
|
||
cat .devcontainer/welcome-message.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
|
||
👋 Welcome to pypsa-eur contribution in a dev container! | ||
Works in VS Code, or in docker using the devcontainer cli | ||
|
||
See https://github.com/drifter089/pypsa-eur/blob/master/README.md for guidance on debugging and contributing to pypsa-eur | ||
|
||
|
||
For details about dev containers see https://containers.dev | ||
|
||
The configuration for the dev container is in the .github/.devcontainer folder. | ||
|
||
🔍 To explore VS Code to its fullest, search using the Command Palette (Cmd/Ctrl + Shift + P or F1).+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu | ||
{ | ||
"name": "pypsa earth dev", | ||
"build": { | ||
"dockerfile": "../../Dockerfile" | ||
}, | ||
|
||
"features": { | ||
"ghcr.io/devcontainers-contrib/features/bash-command:1": {}, | ||
"ghcr.io/eliises/devcontainer-features/bash-profile:1": {} | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"terminal.integrated.profiles.linux": { | ||
"bash": { | ||
"path": "/bin/bash" | ||
} | ||
}, | ||
"extensions": [ | ||
"ms-python.python", | ||
"ms-python.vscode-pylance", | ||
"ms-azuretools.vscode-docker", | ||
"ms-toolsai.jupyter", | ||
"zainchen.json", | ||
"tomoki1207.pdf", | ||
"grapecity.gc-excelviewer" | ||
] | ||
} | ||
}, | ||
|
||
"postCreateCommand": "python -m pip install --upgrade debugpy" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Dev Container Build and Push Image | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- "main" | ||
tags: | ||
- "v*.*.*" | ||
pull_request: | ||
branches: [main] | ||
|
||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
id: checkout | ||
uses: actions/checkout@v1 | ||
- | ||
name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.REGISTRY_TOKEN }} | ||
- | ||
name: Pre-build dev container image | ||
uses: devcontainers/[email protected] | ||
with: | ||
subFolder: .github | ||
imageName: ghcr.io/${{ github.repository }} | ||
cacheFrom: ghcr.io/${{ github.repository }} | ||
push: always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM condaforge/mambaforge | ||
|
||
RUN conda update -n base conda | ||
RUN conda install -n base conda-libmamba-solver | ||
RUN conda config --set solver libmamba | ||
|
||
WORKDIR /pypsa-earth | ||
|
||
COPY ./envs ./envs | ||
|
||
RUN conda env create --file envs/environment.yaml | ||
|
||
RUN rm -r envs | ||
|
||
RUN echo "source activate pypsa-earth" > ~/.bashrc | ||
ENV PATH /opt/conda/envs/pypsa-earth/bin:$PATH | ||
|
||
ENTRYPOINT ["tail", "-f", "/dev/null"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 git | ||
|
||
WORKDIR /pypsa-earth | ||
|
||
COPY . . | ||
|
||
RUN conda env create --file envs/environment.yaml | ||
|
||
RUN echo "source activate pypsa-earth" > ~/.bashrc | ||
ENV PATH /opt/conda/envs/pypsa-earth/bin:$PATH | ||
|
||
RUN /bin/bash -c "source activate pypsa-earth && snakemake -j 1 solve_all_networks" | ||
|
||
RUN git ls-files -z | xargs -0 rm | ||
|
||
RUN find . -type d -empty -delete | ||
|
||
RUN rm -rf scripts config data .snakemake .git | ||
|
||
ENTRYPOINT ["tail", "-f", "/dev/null"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters