Skip to content

Commit baf2bb0

Browse files
authored
Merge pull request #7 from avelytchko/main
Add Docker hub github action flow
2 parents 29ea09a + e4136b9 commit baf2bb0

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Publish Docker image
2+
3+
on:
4+
push
5+
6+
env:
7+
REGISTRY: index.docker.io
8+
# github.repository as <account>/<repo>
9+
IMAGE_NAME: ${{ github.repository }}
10+
11+
jobs:
12+
push_to_registry:
13+
name: Push Docker image to Docker Hub
14+
runs-on: ubuntu-latest
15+
permissions:
16+
packages: write
17+
contents: read
18+
attestations: write
19+
id-token: write
20+
steps:
21+
- name: Check out the repo
22+
uses: actions/checkout@v4
23+
24+
- name: Log in to Docker Hub
25+
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
26+
with:
27+
username: ${{ secrets.DOCKER_USERNAME }}
28+
password: ${{ secrets.DOCKER_PASSWORD }}
29+
30+
- name: Extract metadata (tags, labels) for Docker
31+
id: meta
32+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
33+
with:
34+
images: ${{ env.IMAGE_NAME }}
35+
tags: |
36+
type=raw,value={{date 'YYYYMMDD'}}
37+
38+
- name: Build and push Docker image
39+
id: push
40+
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
41+
with:
42+
context: .
43+
file: ./Dockerfile
44+
push: true
45+
tags: ${{ steps.meta.outputs.tags }}
46+
labels: ${{ steps.meta.outputs.labels }}
47+
48+
- name: Retag image with latest
49+
run: |
50+
docker pull ${{ steps.meta.outputs.tags }}
51+
docker tag ${{ steps.meta.outputs.tags }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
52+
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
53+
54+
- name: Generate artifact attestation
55+
uses: actions/attest-build-provenance@v2
56+
with:
57+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
58+
subject-digest: ${{ steps.push.outputs.digest }}
59+
push-to-registry: true

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ Edit `.env` file with the your secrets and run container.
8484
docker build . -t insta-bot:latest
8585
docker run -d --name insta-bot --restart always --env-file .env insta-bot:latest
8686
```
87+
or use builded image from Docker hub
88+
```
89+
docker run -d --name insta-bot --restart always --env-file .env ovchynnikov/load-bot-linux:latest
90+
```
8791
---
8892

8993
## Troubleshooting

0 commit comments

Comments
 (0)