-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from open-forest-observatory/feature/DR/add-do…
…cker-file Add docker file for dependencies
- Loading branch information
Showing
4 changed files
with
127 additions
and
8 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,54 @@ | ||
name: Publish image to Github Packages | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
attestations: write | ||
id-token: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
- name: Build and push Docker image | ||
id: push | ||
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
- name: Generate artifact attestation | ||
uses: actions/attest-build-provenance@v1 | ||
with: | ||
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} | ||
subject-digest: ${{ steps.push.outputs.digest }} | ||
push-to-registry: true |
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,37 @@ | ||
# Use a GPU-enabled base image | ||
FROM nvcr.io/nvidia/cudagl:11.4.1-runtime-ubuntu20.04 | ||
|
||
USER root | ||
|
||
# Adapted from https://github.com/jeffgillan/agisoft_metashape/blob/main/Dockerfile | ||
LABEL authors="David Russell" | ||
LABEL maintainer="djrussell@ucdavis" | ||
|
||
# Create user account with password-less sudo abilities | ||
RUN useradd -s /bin/bash -g 100 -G sudo -m user | ||
RUN /usr/bin/printf '%s\n%s\n' 'password' 'password'| passwd user | ||
RUN echo "user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
# Install libraries/dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y libgl1-mesa-glx libglu1 \ | ||
libcurl4 \ | ||
wget && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Install the command line python module. Note that this does not install the GUI | ||
RUN apt-get update -y && apt-get install -y python3-pip | ||
RUN cd /opt && wget https://download.agisoft.com/Metashape-2.1.3-cp37.cp38.cp39.cp310.cp311-abi3-linux_x86_64.whl && \ | ||
pip3 install Metashape-2.1.3-cp37.cp38.cp39.cp310.cp311-abi3-linux_x86_64.whl && pip3 install PyYAML && \ | ||
rm -rf *.whl | ||
|
||
# Set the container workdir | ||
WORKDIR /app | ||
# Copy files from current directory into /app | ||
COPY . /app | ||
|
||
# Set the default command and default arguments | ||
ENTRYPOINT ["python3", "/app/python/metashape_workflow.py"] | ||
CMD ["/data/config.yml"] |
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
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