-
Notifications
You must be signed in to change notification settings - Fork 7
51 lines (40 loc) · 1.39 KB
/
docker.yaml
File metadata and controls
51 lines (40 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Docker Hub Release
# This workflow automates the process of building and publishing a Docker image.
# It triggers on a published release, which builds and pushes the image to Docker Hub.
# The Docker image is tagged with the release version from the GitHub tag.
on:
release:
types: [published]
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Free disk space on runner
run: |
set -euxo pipefail
df -h
sudo rm -rf /usr/local/lib/android || true
sudo rm -rf /usr/share/dotnet || true
sudo rm -rf /opt/ghc || true
sudo rm -rf "${AGENT_TOOLSDIRECTORY:-/opt/hostedtoolcache}" || true
docker system prune -af || true
sudo apt-get clean
df -h
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
run: |
VERSION=${GITHUB_REF#refs/tags/}
IMAGE_BASE=${{ secrets.DOCKERHUB_USERNAME }}/slide2vec
# Build the image
docker build -t $IMAGE_BASE:$VERSION -t $IMAGE_BASE:latest .
# Push both tags
docker push $IMAGE_BASE:$VERSION
docker push $IMAGE_BASE:latest