From bf80eab51dd640e4b03b0f119971a842dde17c81 Mon Sep 17 00:00:00 2001 From: Ee Durbin Date: Thu, 1 May 2025 06:15:35 -0400 Subject: [PATCH] build and publish an image for use on planetpython.org --- .github/workflows/publish-docker.yml | 69 ++++++++++++++++++++++++++++ Dockerfile.deploy | 13 ++++++ 2 files changed, 82 insertions(+) create mode 100644 .github/workflows/publish-docker.yml create mode 100644 Dockerfile.deploy diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml new file mode 100644 index 0000000..9e7403a --- /dev/null +++ b/.github/workflows/publish-docker.yml @@ -0,0 +1,69 @@ +name: Publish +on: + push: + branches: + - 'main' +permissions: + contents: write + packages: write +jobs: + release-to-ghcr: + concurrency: + group: release-to-ghcr + cancel-in-progress: false + runs-on: ${{ matrix.config.os }} + strategy: + matrix: + config: + - { os: ubuntu-24.04, arch: amd64 } + - { os: ubuntu-24.04-arm, arch: arm64 } + steps: + # Checkout push-to-registry action github repository + - name: Checkout Push to Registry action + uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login To GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile.deploy + push: true + tags: | + ghcr.io/python/planetpython:${{ github.sha }}-${{ matrix.config.arch }} + ghcr.io/python/planetpython:latest-${{ matrix.config.arch }} + + create-manifests: + runs-on: ubuntu-24.04-arm + needs: [release-to-ghcr] + + steps: + - name: Checkout Push to Registry action + uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login To GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Create SHA image and push + run: | + docker buildx imagetools create \ + --tag ghcr.io/python/planetpython:${{ github.sha }} \ + ghcr.io/python/planetpython:${{ github.sha }}-amd64 \ + ghcr.io/python/planetpython:${{ github.sha }}-arm64 + + - name: Create latest manifest and push + run: | + docker buildx imagetools create \ + --tag ghcr.io/python/planetpython:latest \ + ghcr.io/python/planetpython:latest-amd64 \ + ghcr.io/python/planetpython:latest-arm64 diff --git a/Dockerfile.deploy b/Dockerfile.deploy new file mode 100644 index 0000000..e6ca0bb --- /dev/null +++ b/Dockerfile.deploy @@ -0,0 +1,13 @@ +FROM python:2.7.18 + +ENV PYTHONUNBUFFERED=1 +ENV PYTHONDONTWRITEBYTECODE=1 + +RUN mkdir /planet +WORKDIR /planet + +COPY code /planet/code +COPY config /planet/config +COPY static /planet/static + +