-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (48 loc) · 1.85 KB
/
deploy-to-private-registry.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: 🚀 Stage CI
on:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-push:
environment: stage
runs-on: ubuntu-latest
steps:
- name: 🛒 Checkout repository
uses: actions/checkout@v4
- name: 📂 Add CA certificate to Ubuntu root store and Docker config, then restart Docker
run: |
# Decode CA certificate to a temporary file
echo "${{ secrets.DOCKER_CA_CERT }}" | base64 -d | sudo tee /tmp/registry-ca.crt > /dev/null
# Move the certificate to the system root
sudo mv /tmp/registry-ca.crt /usr/local/share/ca-certificates/registry-ca.crt
# Update system certificates
sudo update-ca-certificates
# Restart Docker to apply the new CA certificate
sudo systemctl restart docker
echo "✅ CA certificate added to system root, Docker config, and Docker restarted."
- name: 🐳 Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-config-inline: |
[registry."${{ secrets.DOCKER_REGISTRY_URL }}"]
ca=["/usr/local/share/ca-certificates/registry-ca.crt"]
- name: 🔑 Log in to Private Registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.DOCKER_REGISTRY_URL }}
username: ${{ secrets.DOCKER_REGISTRY_LOGIN }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
- name: 🏗 Build and Push Docker image
uses: docker/build-push-action@v6
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
tags: ${{ secrets.DOCKER_REGISTRY_URL }}/svaliava-water-site:latest
- name: ✅ Upload completed
run: echo "🎉 Image successfully uploaded to Private Registry!"