forked from sapientinc/HRM-Text
-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (55 loc) · 1.83 KB
/
Copy pathdocker_build_push.yml
File metadata and controls
64 lines (55 loc) · 1.83 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
52
53
54
55
56
57
58
59
60
61
62
63
64
name: docker_build_push
on:
push:
branches:
- main
paths:
- requirements.txt
- docker/**
workflow_dispatch:
concurrency:
group: docker-build-push-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on:
group: CPU-Large-amd64
steps:
- name: Free up disk space
if: ${{ runner.os == 'Linux' }}
run: |
sudo rm -rf /usr/share/dotnet || true
sudo rm -rf /opt/ghc || true
sudo rm -rf /opt/hostedtoolcache/CodeQL || true
- name: Check out repository
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ secrets.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Prepare Docker image name
id: docker_meta
env:
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
DOCKER_NAMESPACE: ${{ secrets.DOCKER_NAMESPACE }}
run: |
repo_name="${GITHUB_REPOSITORY##*/}"
image_name="$(printf '%s' "$repo_name" | tr '[:upper:]' '[:lower:]')"
echo "image=${DOCKER_REGISTRY}/${DOCKER_NAMESPACE}/${image_name}" >> "$GITHUB_OUTPUT"
echo "sha_tag=sha-${GITHUB_SHA::12}" >> "$GITHUB_OUTPUT"
- name: Build and push pretraining environment image
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
platforms: linux/amd64
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
${{ steps.docker_meta.outputs.image }}:latest
${{ steps.docker_meta.outputs.image }}:${{ steps.docker_meta.outputs.sha_tag }}