forked from conda-incubator/conda-store
-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (83 loc) · 3.08 KB
/
build_docker_image.yaml
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: "Publish Dev Docker Images"
on:
push:
branches:
- "main"
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
env:
FORCE_COLOR: "1" # Make tools pretty.
jobs:
build_and_push_docker_image:
name: "Build Docker Images 🛠"
runs-on: ubuntu-latest
strategy:
matrix:
docker-image:
- conda-store
- conda-store-server
platform:
- linux/amd64
- linux/arm64
steps:
- name: "Checkout Repository 🛎"
uses: actions/checkout@v4
- name: "Get project's default Python version 🏷️"
run: |
echo "PYTHON_VERSION_DEFAULT=$(cat .python-version-default)" >> $GITHUB_ENV
- name: "Retrieve secret from Vault 🗝"
uses: hashicorp/vault-action@v3
with:
method: jwt
url: "https://quansight-vault-public-vault-b2379fa7.d415e30e.z1.hashicorp.cloud:8200"
namespace: "admin/quansight"
role: "repository-conda-incubator-conda-store-role"
secrets: |
kv/data/repository/conda-incubator/conda-store/shared_secrets DOCKER_QUANSIGHT_USERNAME | DOCKER_USERNAME;
kv/data/repository/conda-incubator/conda-store/shared_secrets DOCKER_QUANSIGHT_PASSWORD | DOCKER_PASSWORD;
kv/data/repository/conda-incubator/conda-store/shared_secrets QUAY_QUANSIGHT_USERNAME | QUAY_USERNAME;
kv/data/repository/conda-incubator/conda-store/shared_secrets QUAY_QUANSIGHT_PASSWORD | QUAY_PASSWORD;
- name: "Set up Docker Buildx 🏗"
uses: docker/setup-buildx-action@v3
- name: "Login to Docker Hub 🐳"
uses: docker/login-action@v3
with:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
- name: "Login to quay.io 🐳"
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ env.QUAY_USERNAME }}
password: ${{ env.QUAY_PASSWORD }}
- name: "Add Docker metadata 📝"
id: meta
uses: docker/metadata-action@v5
with:
images: |
quansight/${{ matrix.docker-image }}
quay.io/quansight/${{ matrix.docker-image }}
tags: |
type=ref,event=tag
type=sha
# we need this as we are setting the context to subproject directory
- name: "Copy .dockerignore"
run: |
cp .dockerignore ${{ matrix.docker-image }}/.dockerignore
shell: bash
- name: "Publish Docker image 🚀"
uses: docker/build-push-action@v5
with:
context: "${{ matrix.docker-image }}"
target: "dev"
file: "${{ matrix.docker-image }}/Dockerfile"
tags: |
${{ steps.meta.outputs.tags }}
push: true
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
python_version=${{ env.PYTHON_VERSION_DEFAULT }}
platforms: ${{ matrix.platform }}