-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(containers): Containerize some of Jacob's scripts (#105)
- Loading branch information
Showing
5 changed files
with
831 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Build Containers | ||
|
||
on: | ||
push: | ||
branches: [] | ||
paths-ignore: | ||
- 'README.md' | ||
|
||
# Registry for storing Container images | ||
env: | ||
REGISTRY: ghcr.io | ||
|
||
jobs: | ||
build-container: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
needs: test-unit | ||
if: github.event_name != 'pull_request' | ||
strategy: | ||
matrix: | ||
include: | ||
- folder: .containers/icon | ||
image: ${{ env.REGISTRY }}/icon-etl | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Container | ||
id: meta | ||
uses: docker/metadata-action | ||
with: | ||
images: ${{ matrix.image }} | ||
tags: | | ||
type=ref,event=branch | ||
type=semver,pattern={{version}} | ||
- name: Build and push Docker images | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: $${{ matrix.folder }} | ||
file: ${{ matrix.folder }}/Containerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Build a virtualenv using the appropriate Debian release | ||
# * Install python3-venv for the built-in Python3 venv module (not installed by default) | ||
# * Install gcc libpython3-dev to compile C Python modules | ||
# * In the virtualenv: Update pip setuputils and wheel to support building new packages | ||
FROM debian:11-slim AS build | ||
RUN apt-get update && \ | ||
apt-get install --no-install-suggests --no-install-recommends --yes python3-venv gcc libpython3-dev && \ | ||
python3 -m venv /venv && \ | ||
/venv/bin/pip install --upgrade pip setuptools wheel | ||
|
||
# Build the virtualenv | ||
FROM build AS build-venv | ||
RUN /venv/bin/python -m pip install zarr xarray ocf_blosc2 huggingface_hub requests | ||
|
||
# Copy the virtualenv into a distroless image | ||
FROM gcr.io/distroless/python3-debian11 | ||
COPY --from=build-venv /venv /venv | ||
COPY . /app | ||
WORKDIR /app | ||
ENTRYPOINT ["/venv/bin/python3", "main.py"] |
Oops, something went wrong.