Skip to content

Commit 2181997

Browse files
authored
Create build-container.yml
Add an example of a yml file to build a container.
1 parent c938f65 commit 2181997

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

static/module6/build-container.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build and Push Container to Quay.io
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
# Step 1: Check out the repository
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
# Step 2: Set up Python and Conda
17+
- name: Set up Python and Conda
18+
uses: conda-incubator/setup-miniconda@v2
19+
with:
20+
activate-environment: my-geoscience-env
21+
environment-file: environment.yml
22+
auto-activate-base: false
23+
24+
# Step 3: Package the Conda environment as a tarball
25+
- name: Export Conda environment
26+
run: |
27+
conda pack -n my-geoscience-env -o environment.tar.gz
28+
29+
# Step 4: Log in to Quay.io
30+
- name: Log in to Quay.io
31+
run: |
32+
echo "${{ secrets.QUAY_PASSWORD }}" | docker login quay.io -u "${{ secrets.QUAY_USERNAME }}" --password-stdin
33+
34+
# Step 5: Build and push the container to Quay.io
35+
- name: Build and Push to Quay.io
36+
run: |
37+
echo "Building container image"
38+
docker build . -t quay.io/${{ secrets.QUAY_USERNAME }}/my-geoscience-env:latest \
39+
--build-arg CONDA_TARBALL=environment.tar.gz
40+
echo "Pushing container image"
41+
docker push quay.io/${{ secrets.QUAY_USERNAME }}/my-geoscience-env:latest

0 commit comments

Comments
 (0)