Skip to content

Build and Push Docker Image #81

Build and Push Docker Image

Build and Push Docker Image #81

name: Build and Push Docker Image
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
schedule:
# Run daily at 2:00 AM UTC to get latest Claude Code installation
- cron: '0 2 * * *'
env:
REGISTRY: ghcr.io
IMAGE_NAME: obdb/devcontainer
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=sha,prefix=sha-
type=raw,value=latest,enable={{is_default_branch}}
labels: |
org.opencontainers.image.description=OBDb Development Container with Python, Node.js, and Claude Code pre-installed
org.opencontainers.image.source=https://github.com/OBDb/.devcontainer
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}