From 2f40ff78ff735610a710b86b067fbf64aab13306 Mon Sep 17 00:00:00 2001 From: Vojta Mrazek Date: Mon, 21 Jun 2021 14:23:38 +0200 Subject: [PATCH 1/3] Create docker-publish.yml --- .github/workflows/docker-publish.yml | 63 ++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/docker-publish.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 000000000..1b89c652a --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,63 @@ +name: Docker + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +on: + schedule: + - cron: '26 3 * * 1,3,5' + push: + branches: [ master ] + # Publish semver tags as releases. + tags: [ 'v*.*.*' ] + pull_request: + branches: [ master ] + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io + # github.repository as / + IMAGE_NAME: ${{ github.repository }} + + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Extract metadata (tags, labels) for Docker + # https://github.com/docker/metadata-action + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + # Build and push Docker image with Buildx (don't push on PR) + # https://github.com/docker/build-push-action + - name: Build and push Docker image + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From 38fd304e3d8471c4ef57c90a75fc1dd269ea9c16 Mon Sep 17 00:00:00 2001 From: Vojta Mrazek Date: Mon, 21 Jun 2021 14:36:12 +0200 Subject: [PATCH 2/3] Update docker-publish.yml --- .github/workflows/docker-publish.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 1b89c652a..5511bbad0 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -33,6 +33,13 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 + + - name: Cache sources + id: cache-sources + uses: actions/cache@v2 + with: + path: . + key: cache-yosys # Login against a Docker registry except on PR # https://github.com/docker/login-action From 105875482b99c221bb60aedd0bcebf482db529d6 Mon Sep 17 00:00:00 2001 From: Vojta Mrazek Date: Mon, 21 Jun 2021 15:45:28 +0200 Subject: [PATCH 3/3] entry point --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index 549c73c97..683e89b61 100644 --- a/Dockerfile +++ b/Dockerfile @@ -54,4 +54,7 @@ ENV PATH /opt/yosys/bin:$PATH RUN useradd -m yosys USER yosys +VOLUME ["/app"] +WORKDIR /app + CMD ["yosys"]