-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (32 loc) · 1 KB
/
build.yml
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
name: Build Docker Container
permissions:
contents: write
packages: write
on:
push:
branches:
- main
env:
IMAGE_NAME: image-captioning-fed-server
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Set up Git repository
uses: actions/checkout@v2
with:
token: ${{ secrets.PAT }}
- name: Log in to the Docker hub
run: docker login -u ${{secrets.DOCKER_USER}} -p ${{secrets.DOCKER_PASS}}
- name: Get file version
id: get-version
run: |
VERSION=$(cat image-captioning/version.txt)
echo "File version: $VERSION"
echo "::set-output name=version::$VERSION"
- name: Build and Push Docker Image
run: |
docker build -t "${{secrets.DOCKER_USER}}/${IMAGE_NAME}:${{ steps.get-version.outputs.version }}" .
docker push "${{secrets.DOCKER_USER}}/${IMAGE_NAME}:${{ steps.get-version.outputs.version }}"