Skip to content

Commit

Permalink
chore: Dev Containersにキャッシュがかかるように変更 (#51)
Browse files Browse the repository at this point in the history
Co-authored-by: rai <[email protected]>
  • Loading branch information
sou1118 and r4ai authored Oct 11, 2024
1 parent 42233c9 commit e308c6c
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "program-grading-system",
"build": {
"dockerfile": "../Dockerfile",
"cacheFrom": "ghcr.io/tus-project-team/program-grading-system-devcontainer:main",
"args": {
"UID": "1000",
"GID": "1000"
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/devcontainer-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Devcontainer CI
on:
push:
branches:
- main
workflow_dispatch:

jobs:
changes:
name: Changes
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
outputs:
dockerfile: ${{ steps.changes.outputs.dockerfile }}
tool-versions: ${{ steps.changes.outputs.tool-versions }}
workflows: ${{ steps.changes.outputs.workflows }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Check Dockerfile files changed
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
with:
filters: |
dockerfile:
- 'Dockerfile'
tool-versions:
- '.tool-versions'
workflows:
- '.github/workflows/devcontainer-ci.yml'
build:
name: Build and push Docker image
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
needs: changes
if: needs.changes.outputs.dockerfile == 'true' || needs.changes.outputs.tool-versions == 'true' || needs.changes.outputs.workflows == 'true'
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Login to GitHub Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and run dev container task
uses: devcontainers/ci@a56d055efecd725e8cfe370543b6071b79989cc8
with:
imageName: ghcr.io/${{ github.repository }}-devcontainer:${{ github.ref_name }}

0 comments on commit e308c6c

Please sign in to comment.