-
Notifications
You must be signed in to change notification settings - Fork 154
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 #266 from jasminabrar/master
Added automated docker build process
- Loading branch information
Showing
4 changed files
with
110 additions
and
26 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,75 @@ | ||
name: Create and Publish Docker Image | ||
|
||
on: | ||
release: | ||
types: | ||
- created | ||
repository: | ||
- 'SiEPIC/SiEPIC_EBeam_PDK' | ||
- 'SiEPIC/SiEPIC-Tools' | ||
|
||
push: | ||
branches: [ "master" ] | ||
paths: | ||
- 'Dockerfile' | ||
pull_request: | ||
types: | ||
- closed | ||
branches: [ "master" ] | ||
paths: | ||
- 'Dockerfile' | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }}/siepic_klayout | ||
|
||
jobs: | ||
build-and-push-image: | ||
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Check pull request was merged | ||
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == false | ||
run: | | ||
echo "Error: Pull request is not merged." | ||
exit 1 | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get the current date | ||
id: date | ||
run: echo "::set-output name=date::$(date +%Y%m%d)" | ||
|
||
- 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 as latest image | ||
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }}-latest | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
- name: Build and push Docker image as unique image | ||
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | ||
with: | ||
context: . | ||
push: true | ||
tags: "${{ steps.meta.outputs.tags }}.${{ steps.date.outputs.date }}.${{ github.run_number }}" | ||
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
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,23 @@ | ||
FROM quay.io/centos/centos:stream8 | ||
|
||
# Update the system and install necessary tools. | ||
RUN dnf -y update && \ | ||
dnf -y install wget bzip2 unzip git mesa-dri-drivers python3-pip | ||
|
||
# Install the newest version of KLayout | ||
RUN wget https://www.klayout.org/downloads/CentOS_8/klayout-0.28.12-0.x86_64.rpm -O ~/klayout.rpm && \ | ||
dnf -y localinstall ~/klayout.rpm && \ | ||
rm ~/klayout.rpm | ||
|
||
# Clone SiEPIC-Tools and SiEPIC_EBeam_PDK. | ||
RUN mkdir -p /root/.klayout/salt && \ | ||
cd /root/.klayout/salt && \ | ||
git clone https://github.com/SiEPIC/SiEPIC-Tools.git && \ | ||
git clone https://github.com/SiEPIC/SiEPIC_EBeam_PDK.git | ||
|
||
# Set the working directory | ||
WORKDIR /home | ||
|
||
# Set PATH | ||
ENV PATH="/usr/local/bin:${PATH}:/usr/local/bin/python3:/root/.local/bin" | ||
ENV QT_QPA_PLATFORM=minimal |
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