Spaces:
Sleeping
Sleeping
Clement Vachet
commited on
Commit
·
ed8fa19
1
Parent(s):
f4ccbcf
Add Github action - publish docker image
Browse files
.github/workflows/publish_docker_image.yml
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This workflow uses actions that are not certified by GitHub.
|
| 2 |
+
# They are provided by a third-party and are governed by
|
| 3 |
+
# separate terms of service, privacy policy, and support
|
| 4 |
+
# documentation.
|
| 5 |
+
|
| 6 |
+
# GitHub recommends pinning actions to a commit SHA.
|
| 7 |
+
# To get a newer version, you will need to update the SHA.
|
| 8 |
+
# You can also reference a tag or branch, but the action may change without warning.
|
| 9 |
+
|
| 10 |
+
name: Publish Docker image
|
| 11 |
+
|
| 12 |
+
on:
|
| 13 |
+
push:
|
| 14 |
+
branches: [ 'main' ]
|
| 15 |
+
workflow_dispatch:
|
| 16 |
+
|
| 17 |
+
jobs:
|
| 18 |
+
push_to_registry:
|
| 19 |
+
name: Push Docker image to Docker Hub
|
| 20 |
+
runs-on: ubuntu-latest
|
| 21 |
+
permissions:
|
| 22 |
+
packages: write
|
| 23 |
+
contents: read
|
| 24 |
+
attestations: write
|
| 25 |
+
id-token: write
|
| 26 |
+
steps:
|
| 27 |
+
- name: Check out the repo
|
| 28 |
+
uses: actions/checkout@v4
|
| 29 |
+
|
| 30 |
+
- name: Set up Python
|
| 31 |
+
uses: actions/setup-python@v4
|
| 32 |
+
with:
|
| 33 |
+
python-version: '3.11'
|
| 34 |
+
|
| 35 |
+
- name: Install dependencies
|
| 36 |
+
run: |
|
| 37 |
+
python -m pip install --upgrade pip
|
| 38 |
+
pip install -r requirements.txt
|
| 39 |
+
|
| 40 |
+
- name: Log in to Docker Hub
|
| 41 |
+
uses: docker/login-action@v3
|
| 42 |
+
with:
|
| 43 |
+
username: ${{ secrets.DOCKER_USERNAME }}
|
| 44 |
+
password: ${{ secrets.DOCKER_TOKEN }}
|
| 45 |
+
|
| 46 |
+
- name: Extract metadata (tags, labels) for Docker
|
| 47 |
+
id: meta
|
| 48 |
+
uses: docker/metadata-action@v5
|
| 49 |
+
with:
|
| 50 |
+
images: cvachet/object-detection-ecs
|
| 51 |
+
|
| 52 |
+
- name: Build and push Docker image
|
| 53 |
+
id: push
|
| 54 |
+
uses: docker/build-push-action@v6
|
| 55 |
+
with:
|
| 56 |
+
context: .
|
| 57 |
+
file: ./Dockerfile
|
| 58 |
+
push: true
|
| 59 |
+
tags: cvachet/object-detection-ecs:latest
|
| 60 |
+
# tags: ${{ steps.meta.outputs.tags }}
|
| 61 |
+
# labels: ${{ steps.meta.outputs.labels }}
|