-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docker-in-docker (dind) devcontainer image to be used for labs (#2058)
* devcontainer init * fix name * cleanup devcontainer setup * set user to "user" staticly
- Loading branch information
Showing
3 changed files
with
84 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,5 @@ | ||
FROM public.ecr.aws/docker/library/debian:12-slim | ||
|
||
# Switch to user | ||
USER user | ||
ENV PATH=$PATH:/home/${USERNAME}/.local/bin |
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,32 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. | ||
{ | ||
"build": { | ||
"dockerfile": "./Dockerfile", | ||
"context": "." | ||
// "args": { | ||
// "USERNAME": "${localEnv:USERNAME}" | ||
// } | ||
}, | ||
"features": { | ||
"ghcr.io/devcontainers/features/docker-in-docker:2": { | ||
"version": "latest", | ||
"dockerDashComposeVersion": "none" | ||
}, | ||
// Add sshd to support gh cli codespace cp. | ||
"ghcr.io/devcontainers/features/sshd:1": { | ||
"version": "latest" | ||
} | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
// Python. | ||
"ms-python.python", | ||
"ms-python.vscode-pylance", | ||
// Errors and highlighters. | ||
"mechatroner.rainbow-csv", | ||
"oderwat.indent-rainbow" | ||
] | ||
} | ||
} | ||
} |
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,47 @@ | ||
name: dind-devcontainer | ||
on: | ||
workflow_dispatch: | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
jobs: | ||
dind-devcontainer: | ||
name: lint | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log into registry ${{ env.REGISTRY }} | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ github.repository }} | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
# git short commit | ||
type=sha | ||
- name: Pre-build dev container image 🔨 | ||
uses: devcontainers/[email protected] | ||
# env: | ||
# USERNAME: ${{ inputs.username }} | ||
# UID: ${{ inputs.user_id }} | ||
# GID: ${{ inputs.group_id }} | ||
with: | ||
subFolder: .github/containers/dind | ||
imageName: ghcr.io/${{ github.repository }}/clab-dind | ||
imageTag: ${{ steps.meta.outputs.tags }} | ||
push: always |