-
Notifications
You must be signed in to change notification settings - Fork 8
35 lines (29 loc) · 1.09 KB
/
dockerBuildPush.yml
File metadata and controls
35 lines (29 loc) · 1.09 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
name: Build and Push to Docker Hub
on:
push:
paths:
- 'src/microbots/environment/local_docker/image_builder/Dockerfile'
- 'src/microbots/environment/local_docker/image_builder/dockerShell.py'
- 'src/microbots/environment/local_docker/image_builder/ShellCommunicator.py'
- '.github/workflows/dockerBuildPush.yml'
branches:
- main
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- 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: |
IMAGE_NAME=${{ secrets.DOCKERHUB_USERNAME }}/shell_server
TAG=${{ github.sha }}
# build with both commit SHA and latest tag
docker build -f src/microbots/environment/local_docker/image_builder/Dockerfile -t $IMAGE_NAME:$TAG -t $IMAGE_NAME:latest .
docker push $IMAGE_NAME:$TAG
docker push $IMAGE_NAME:latest