-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add devcontainer Docker image #6482
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
Merged
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
60da832
Switch base image
maresb dece5e0
Update base image
maresb 1859f43
Add Live Share extension
maresb da64c05
Update devcontainer base image
maresb a36c45e
Use _dev-init.sh as startup command
maresb 6bd4544
Also run _dev-init.sh in init section
maresb dde2381
Update base devcontainer
maresb d344190
Remove Live Share since doesn't exist on OpenVSX
maresb 6c368ae
Add Pyright extension
maresb ce59496
Set default interpreter path
maresb 99da664
Install pre-commit hooks in background
maresb cc158bd
Also set python.pythonPath
maresb 183cbdc
Remove deprecated python.pythonPath setting
maresb bc783b6
Add Git History plugin
maresb cff4801
Install pre-commit hooks in foreground
maresb e8c9e27
Add .dockerignore
maresb 55ddc43
Add dev.Dockerfile
maresb fc7634a
Add workflow to build devcontainer
maresb adc0872
Disable arm64 devcontainer builds
maresb 0cc5909
Sudo
maresb 5b8bcc3
Use prebuilt PyMC devcontainer
maresb a9ca5ff
Make all files writeable
maresb 57c3fef
Copy pre-built pre-commit cache if it doesn't exist yet
maresb 11e5106
Run chmod with sudo
maresb 5a560a0
Use updated devcontainer
maresb e756703
Make chmod recursive
maresb 180857f
Update devcontainer base
maresb e25f841
Set PRE_COMMIT_HOME to save precomputed cache
maresb cab57ea
Chown conda-meta/history
maresb 008d78c
Update devcontainer base image
maresb 8a5a127
Remove GHA version comments
maresb 3581165
Name image as pymc-devcontainer
maresb 91ea267
Use latest available pymc-devcontainer
maresb 1e2f193
Bump devcontainer base version
maresb c506caa
Ensure pre-commit hooks are installed
maresb 1af8658
Add some vscode settings
maresb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,2 @@ | ||
.git | ||
.mypy_cache |
This file contains hidden or 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,54 @@ | ||
name: devcontainer-docker-image | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }}-devcontainer # pymc-devs/pymc-devcontainer | ||
|
||
jobs: | ||
build-container: | ||
runs-on: ubuntu-latest | ||
|
||
# Set permissions for GitHub token | ||
# <https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#authenticating-to-package-registries-on-github> | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b | ||
|
||
- name: Setup Docker buildx | ||
uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6 | ||
|
||
- name: Prepare metadata | ||
id: meta | ||
uses: docker/metadata-action@69f6fc9d46f2f8bf0d5491e4aabe0bb8c6a4678a | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=sha,enable=true,prefix=git- | ||
type=raw,value=latest | ||
|
||
- name: Log into registry ${{ env.REGISTRY }} | ||
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
id: docker_build | ||
uses: docker/build-push-action@e551b19e49efd4e98792db7592c17c09b89db8d8 | ||
with: | ||
context: . | ||
file: scripts/dev.Dockerfile | ||
platforms: linux/amd64 # ,linux/arm64 | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | ||
cache-to: type=inline |
This file contains hidden or 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
This file contains hidden or 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,21 @@ | ||
FROM ghcr.io/mamba-org/micromamba-devcontainer:git-5185ae9 | ||
|
||
COPY --chown=${MAMBA_USER}:${MAMBA_USER} conda-envs/environment-dev.yml /tmp/environment-dev.yml | ||
RUN : \ | ||
&& micromamba install --yes --name base --file /tmp/environment-dev.yml \ | ||
&& micromamba clean --all --yes \ | ||
&& rm /tmp/environment-dev.yml \ | ||
&& sudo chmod -R a+rwx /opt/conda \ | ||
; | ||
|
||
ARG MAMBA_DOCKERFILE_ACTIVATE=1 | ||
|
||
COPY --chown=${MAMBA_USER}:${MAMBA_USER} .pre-commit-config.yaml /fake-repo/.pre-commit-config.yaml | ||
RUN : \ | ||
&& sudo mkdir --mode=777 /opt/.pre-commit-cache-prebuilt \ | ||
&& cd /fake-repo \ | ||
&& git init \ | ||
&& PRE_COMMIT_HOME=/opt/.pre-commit-cache-prebuilt pre-commit install-hooks \ | ||
&& sudo rm -rf /fake-repo \ | ||
&& sudo chmod -R a+rwx /opt/.pre-commit-cache-prebuilt \ | ||
; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use a pymc channel here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but it needs to exist first. To create it, it should be sufficient to merge this, then run the "create devcontainer" GitHub Action (via the workflow dispatch button). Then we can change the channel here.
But this is only needed when changing the dependencies, so for the moment there is no problem to keep my channel.