Skip to content

Commit

Permalink
Update devcontainer setup and use GHCR to host the image
Browse files Browse the repository at this point in the history
Signed-off-by: Marek Pikuła <[email protected]>
  • Loading branch information
MarekPikula committed May 31, 2023
1 parent e0f5e92 commit f11fd39
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 31 deletions.
18 changes: 0 additions & 18 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,3 @@
# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster
ARG VARIANT="3.7"
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}

# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
# ARG NODE_VERSION="none"
# RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi

RUN pipx install poetry

# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image.
# COPY requirements.txt /tmp/pip-tmp/
# RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
# && rm -rf /tmp/pip-tmp

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>

# [Optional] Uncomment this line to install global node packages.
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
31 changes: 18 additions & 13 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@
{
"name": "Python 3",
"build": {
"dockerfile": "Dockerfile",
"context": "..",
"dockerfile": "./Dockerfile",
"context": ".",
"args": {
// Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7, 3.6
// Append -bullseye or -buster to pin to an OS version.
// Use -bullseye variants on local on arm64/Apple Silicon.
"VARIANT": "3.7",
}
"VARIANT": "3.7"
},
"cacheFrom": "ghcr.io/systemrdl/peakrdl-markdown/devcontainer"
},
"features": {
"ghcr.io/meaningful-ooo/devcontainer-features/fish:1": {},
"ghcr.io/devcontainers-contrib/features/poetry:2": {}
},

// Configure tool-specific properties.
Expand All @@ -27,18 +32,22 @@
"python.linting.mypyPath": "${workspaceFolder}/.venv/bin/mypy",
"python.linting.pycodestylePath": "${workspaceFolder}/.venv/bin/pycodestyle",
"python.linting.pydocstylePath": "${workspaceFolder}/.venv/bin/pydocstyle",
"python.venvPath": "${workspaceFolder}/.venv",
"python.venvPath": "${workspaceFolder}/.venv"
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"bungcip.better-toml",
"charliermarsh.ruff",
"github.vscode-github-actions",
"GitHub.vscode-pull-request-github",
"mhutchie.git-graph",
"ms-python.python",
"njpwerner.autodocstring",
"ms-python.vscode-pylance",
"njpwerner.autodocstring",
"ryanluker.vscode-coverage-gutters",
"mhutchie.git-graph",
"GitHub.vscode-pull-request-github"
"streetsidesoftware.code-spell-checker"
]
}
},
Expand All @@ -47,12 +56,8 @@
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "poetry config virtualenvs.in-project true && poetry install",
"postCreateCommand": "poetry install --all-extras",

// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
"features": {
"git": "os-provided",
"fish": "latest"
}
"remoteUser": "vscode"
}
21 changes: 21 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,27 @@ on:


jobs:
build-devcontainer:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout (GitHub)
uses: actions/checkout@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and run Dev Container task
uses: devcontainers/[email protected]
with:
imageName: ghcr.io/systemrdl/peakrdl-markdown/devcontainer
cacheFrom: ghcr.io/systemrdl/peakrdl-markdown/devcontainer
push: always

test:
runs-on: ubuntu-latest
strategy:
Expand Down

0 comments on commit f11fd39

Please sign in to comment.