Claim volume mountpoints via image entrypoint, stop destroying shared… #5
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
| name: Publish Workspace Images | |
| on: | |
| push: | |
| branches: [master] | |
| paths: | |
| - "src/**" | |
| - "scripts/**" | |
| - ".github/workflows/publish-workspaces.yml" | |
| tags: ["v*"] | |
| workflow_dispatch: | |
| jobs: | |
| base: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| packages: write | |
| outputs: | |
| short_sha: ${{ steps.sha.outputs.short }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Compute short sha | |
| id: sha | |
| run: echo "short=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT" | |
| - name: Lowercase image name | |
| id: img | |
| run: echo "name=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/coder-workspace" >> "$GITHUB_OUTPUT" | |
| - uses: docker/setup-qemu-action@v4 | |
| - uses: docker/setup-buildx-action@v4 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract tags | |
| id: meta | |
| uses: docker/metadata-action@v6 | |
| with: | |
| images: ${{ steps.img.outputs.name }} | |
| tags: | | |
| type=raw,value=base | |
| type=sha,format=short,prefix=base- | |
| - name: Build and push | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: ./src/base/Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha,scope=workspace-base | |
| cache-to: type=gha,mode=max,scope=workspace-base | |
| stacks: | |
| needs: base | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| stack: [node, cpp] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Lowercase image name | |
| id: img | |
| run: echo "name=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/coder-workspace" >> "$GITHUB_OUTPUT" | |
| - uses: docker/setup-qemu-action@v4 | |
| - uses: docker/setup-buildx-action@v4 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract tags | |
| id: meta | |
| uses: docker/metadata-action@v6 | |
| with: | |
| images: ${{ steps.img.outputs.name }} | |
| tags: | | |
| type=raw,value=${{ matrix.stack }} | |
| type=sha,format=short,prefix=${{ matrix.stack }}- | |
| - name: Build and push | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: ./src/${{ matrix.stack }}/Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| build-args: | | |
| BASE_IMAGE=${{ steps.img.outputs.name }}:base-${{ needs.base.outputs.short_sha }} | |
| cache-from: type=gha,scope=workspace-${{ matrix.stack }} | |
| cache-to: type=gha,mode=max,scope=workspace-${{ matrix.stack }} |