Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 16 additions & 28 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,25 @@
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.117.1/containers/go
{
"name": "devcontainers-ci",
"dockerFile": "Dockerfile",
"name": "Test CI/CD Project",
"build": {
"cacheFrom": "ghcr.io/devcontainers/ci-devcontainer:latest"
"dockerfile": "Dockerfile"
},
"mounts": [
// Keep command history
"source=devcontainer-build-run-bashhistory,target=/home/vscode/commandhistory",
// Mount host docker socket
"type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock"
],
"postCreateCommand": ".devcontainer/scripts/postCreate.sh",
"remoteUser": "vscode",
"features": {
"ghcr.io/devcontainers/features/git:1": {
"version": "latest"
}
},
"postCreateCommand": "chmod +x scripts/*.sh && scripts/post-create.sh",
"postStartCommand": "chmod +x scripts/*.sh && scripts/post-start.sh",
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.defaultProfile.linux": "bash",
"files.eol": "\n"
},
"extensions": [
"ms-azuretools.vscode-docker",
"yzhang.markdown-all-in-one",
"davidanson.vscode-markdownlint",
"heaths.vscode-guid",
"esbenp.prettier-vscode",
"meganrogge.template-string-converter",
"ms-azure-devops.azure-pipelines"
]
"ms-azuretools.vscode-docker"
],
"settings": {
"terminal.integrated.defaultProfile.linux": "bash"
}
}
},
"features": {
"ghcr.io/devcontainers/features/github-cli:1": "latest"
}
"remoteUser": "root",
"forwardPorts": []
}
7 changes: 7 additions & 0 deletions .devcontainer/scripts/post-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

#!/bin/bash

# This script runs after the container is created
echo 'Post-create script running (/.devcontainer/scripts)...'
echo "Current folder: $(pwd)"
echo "Current user: $(whoami)"
5 changes: 4 additions & 1 deletion .devcontainer/scripts/postCreate.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/bin/bash

sudo npm install --location=global yarn
# This script runs after the container is created
echo 'Post-create script running (/.devcontainer/scripts)...'
echo "Current folder: $(pwd)"
echo "Current user: $(whoami)"
42 changes: 42 additions & 0 deletions .github/workflows/post-create.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Test CI/CD with DevContainer Builder

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test-custom-builder:
runs-on: ubuntu-latest

# Add permissions for pushing to GitHub Container Registry
permissions:
contents: read
packages: write

steps:
- name: Checkout code
uses: actions/checkout@v3

# Add authentication step for GitHub Container Registry
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Pre-build dev container image
uses: devcontainers/ci@v0.3
with:
imageName: ghcr.io/${{ github.repository }}/devcontainer
# cacheFrom: ghcr.io/${{ github.repository }}/devcontainer
# push: always

- name: Run make ci-build in dev container
uses: devcontainers/ci@v0.3
with:
push: never
runCmd: python3 special_add.py
# ...existing code...
6 changes: 6 additions & 0 deletions scripts/post-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

# This script runs after the container is created
echo 'Post-create script running from (/workspace/scripts)...'
echo "Current folder: $(pwd)"
echo "Current user: $(whoami)"
Loading