Skip to content

Commit

Permalink
add Dockerfile and build/publish action (#15)
Browse files Browse the repository at this point in the history
* Add Dockerfile and GitHub Actions workflow for building and publishing Docker image

* Update build-essential version in Dockerfile
  • Loading branch information
rvhonorato authored Mar 20, 2024
1 parent 9e77e26 commit dfd0fcd
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#
name: build and publish an image

on:
push:
# run only against tags
tags:
- "*"

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:
runs-on: ubuntu-latest
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: 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/login-action@v3
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/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#==============================================================================================
FROM continuumio/anaconda3:2022.10

RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential=12.9 \
&& \
apt-get clean && rm -rf /var/lib/apt/lists/*

WORKDIR /opt/software
COPY . .
RUN pip install .
WORKDIR /data

ENTRYPOINT [ "prodigy_cryst" ]
#==============================================================================================

0 comments on commit dfd0fcd

Please sign in to comment.