Skip to content

Commit

Permalink
feat: initiate migration to devcontainer prebuilds
Browse files Browse the repository at this point in the history
  • Loading branch information
phorcys420 committed Aug 5, 2024
1 parent 4139820 commit e41b14f
Show file tree
Hide file tree
Showing 19 changed files with 578 additions and 478 deletions.
21 changes: 21 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"image": "mcr.microsoft.com/devcontainers/javascript-node:1-20-bookworm",
"customizations": {
"vscode": {
"settings": {
"json.schemas": [
{
"fileMatch": ["*/devcontainer-feature.json"],
"url": "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainerFeature.schema.json"
}
]
},
"extensions": ["mads-hartmann.bash-ide-vscode"]
}
},
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
},
"remoteUser": "node",
"updateContentCommand": "npm install -g @devcontainers/cli"
}
File renamed without changes.
9 changes: 9 additions & 0 deletions .github/devcontainer/base/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "uwu/basic-env - Base",

"build": {
"dockerfile": "Dockerfile"
},

"remoteUser": "coder"
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM uwunet/basic-env-base:latest
FROM ghcr.io/uwu/basic-env/base:latest

USER root

Expand Down
10 changes: 10 additions & 0 deletions .github/devcontainer/dart/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "uwu/basic-env - Dart",

"build": {
"dockerfile": "Dockerfile"
},

"remoteUser": "coder"
}

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM uwunet/basic-env-base:latest

USER root

# Install requirements
RUN DEBIAN_FRONTEND="noninteractive" apt install -y zip unzip

USER coder

# Install sdkman
FROM ghcr.io/uwu/basic-env/base:latest

USER root

# Install requirements
RUN DEBIAN_FRONTEND="noninteractive" apt install -y zip unzip

USER coder

# Install sdkman
RUN curl -s "https://get.sdkman.io" | bash
10 changes: 10 additions & 0 deletions .github/devcontainer/java/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "uwu/basic-env - Java",

"build": {
"dockerfile": "Dockerfile"
},

"remoteUser": "coder"
}

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM uwunet/basic-env-base:latest
FROM ghcr.io/uwu/basic-env/base:latest

# nvm + node + pnpm
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
Expand Down
10 changes: 10 additions & 0 deletions .github/devcontainer/javascript/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "uwu/basic-env - JavaScript",

"build": {
"dockerfile": "Dockerfile"
},

"remoteUser": "coder"
}

32 changes: 32 additions & 0 deletions .github/workflows/_build-and-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: (reusable) Dev Container Build and Push images

on:
workflow_call:
inputs:
image:
required: true
type: string

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
if: github.event_name != 'pull_request'

- name: "Pre-build '${{ inputs.image }}' image"
uses: devcontainers/ci@v0.3
with:
subFolder: .github/devcontainer/${{ inputs.image }}
imageName: ghcr.io/${{ github.repository }}/${{ inputs.image }}
cacheFrom: ghcr.io/${{ github.repository }}/${{ inputs.image }}
push: ${{ github.event_name != 'pull_request' && 'always' || 'never' }}
16 changes: 16 additions & 0 deletions .github/workflows/build-and-push-base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Build & push base image

on:
workflow_dispatch:
push:
branches:
- "main"
pull_requests:
branches:
- "main"

jobs:
build:
uses: uwu/basic-env/.github/workflows/_build-and-push.yml@main
with:
image: base
19 changes: 19 additions & 0 deletions .github/workflows/build-and-push-others.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Build & push other images

on:
workflow_dispatch:
push:
branches:
- "main"
pull_requests:
branches:
- "main"

jobs:
build:
uses: uwu/basic-env/.github/workflows/_build-and-push.yml@main
strategy:
matrix:
image: [dart, java, javascript]
with:
image: ${{ matrix.image }}
Loading

0 comments on commit e41b14f

Please sign in to comment.