Skip to content

Commit

Permalink
add oci image build
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoblitt committed Sep 5, 2024
1 parent 471ae5e commit d89a628
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/oci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
name: OCI Build and Publish

"on":
workflow_dispatch:
push:
branches:
- "**"
tags:
- "v*.*.*"
pull_request:
branches:
- main
- master

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
oci_image:
name: Build OCI Image
if: github.repository == 'lsst/s3daemon'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM python:3.12

WORKDIR /app
COPY . .
RUN pip install --no-cache-dir --root-user-action ignore .
ENTRYPOINT ["s3daemon"]
19 changes: 19 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
[project]
name = "s3daemon"
dynamic = ["version", "dependencies"]

[build-system]
requires = ["setuptools>=64", "setuptools_scm>=8"]
build-backend = "setuptools.build_meta"

[project.scripts]
s3daemon = "s3daemon.s3daemon:main"

[tool.setuptools_scm]

[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}

[tool.setuptools]
package-dir = {"" = "python"}

[tool.black]
line-length = 110
target-version = ["py311"]
Expand Down

0 comments on commit d89a628

Please sign in to comment.