ci: automate dev container build via devcontainer.json + workflow
Adds .devcontainer/devcontainer.json that points to Dockerfile.dev so any devcontainer-aware tool (VS Code, Codespaces, etc.) can build the local dev environment directly from source. Adds a Forgejo workflow that rebuilds and pushes the image to codeberg.org/guettli/sharedinbox-dev (tagged both :latest and the short commit SHA) whenever Dockerfile.dev, the devcontainer config, or the workflow itself changes on main. This prevents the published image from silently drifting from its source. The workflow uses the built-in FORGEJO_TOKEN to log in to the Codeberg container registry - no extra secrets needed. Closes #552 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
ee238b85c7
commit
582bc439db
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "SharedInbox Dev",
|
||||
"build": {
|
||||
"dockerfile": "../Dockerfile.dev",
|
||||
"context": ".."
|
||||
},
|
||||
"workspaceFolder": "/src",
|
||||
"workspaceMount": "source=${localWorkspaceFolder},target=/src,type=bind,consistency=cached",
|
||||
"remoteUser": "ci"
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
name: Publish Dev Container
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- 'Dockerfile.dev'
|
||||
- '.devcontainer/devcontainer.json'
|
||||
- '.forgejo/workflows/publish-dev-container.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
name: Build & Push sharedinbox-dev
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
env:
|
||||
REGISTRY: codeberg.org
|
||||
IMAGE: codeberg.org/guettli/sharedinbox-dev
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Log in to Codeberg container registry
|
||||
env:
|
||||
FORGEJO_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
echo "$FORGEJO_TOKEN" \
|
||||
| docker login "$REGISTRY" -u "${{ github.actor }}" --password-stdin
|
||||
|
||||
- name: Build image
|
||||
run: |
|
||||
SHORT_SHA="${GITHUB_SHA:0:7}"
|
||||
docker build \
|
||||
-t "$IMAGE:latest" \
|
||||
-t "$IMAGE:$SHORT_SHA" \
|
||||
-f Dockerfile.dev \
|
||||
.
|
||||
|
||||
- name: Push image
|
||||
run: |
|
||||
SHORT_SHA="${GITHUB_SHA:0:7}"
|
||||
docker push "$IMAGE:latest"
|
||||
docker push "$IMAGE:$SHORT_SHA"
|
||||
Reference in New Issue
Block a user