Skip to content

Commit

Permalink
feat: add initial image
Browse files Browse the repository at this point in the history
  • Loading branch information
dgpalmieri committed Jan 2, 2025
0 parents commit f37b36c
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/publish_image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# https://docs.github.com/en/actions/publishing-packages/publishing-docker-images
name: Create and publish a Docker image

# Configures this workflow to run every time a change is pushed to the branch called `release`.
on:
push:
branches: ['main']

# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
jobs:
build-and-push-image:
# Don't run if updating documentation
if: "!startsWith(github.event.head_commit.message, 'docs')"
runs-on: ubuntu-latest
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
attestations: write
id-token: write
#
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
- name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
- name: Build and push Docker image
id: push
uses: docker/[email protected]
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

# This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see "[AUTOTITLE](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds)."
- name: Generate artifact attestation
uses: actions/[email protected]
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM ghcr.io/asfopensarlab/deployment-opensarlab-container_sar:sha256-7e2596f77e47b71acc7b2af66a8001315ab8c67149725afc61acc736a0131015

COPY geos419.yml /tmp/geos419.yml

RUN mamba env create -f /tmp/geos419.yml &&\
/opt/conda/envs/geos419/bin/python -m ipykernel install --prefix /opt/conda/envs/geos419 --name geos419 --display-name "geos419" &&\
rm -rf /opt/conda/pkgs/cache

11 changes: 11 additions & 0 deletions geos419.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: geos419
channels:
- conda-forge
- defaults
dependencies:
- python=3.12
- pip=24.0
- numpy=2.0.0
- matplotlib=3.8.4
- ipython=8.29.0
- jupyterlab=4.2.3

0 comments on commit f37b36c

Please sign in to comment.