From e7d5480c5aa0630ecfdc694ab375821df0281568 Mon Sep 17 00:00:00 2001 From: Jannik Streek Date: Thu, 21 Dec 2023 15:41:46 +0100 Subject: [PATCH] add release workflow --- .github/workflows/release.yml | 59 +++++++++++++++++++++++++++++++++++ .gitignore | 4 ++- docker-compose.yml | 21 ++++++++++--- 3 files changed, 78 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f41f577 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,59 @@ +# https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-ghcrio + +# 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. + +# GitHub recommends pinning actions to a commit SHA. +# To get a newer version, you will need to update the SHA. +# You can also reference a tag or branch, but the action may change without warning. + +name: Create and publish a Docker image + +on: + release: + types: [published] + push: + branches: + - main + - add-release-workflow + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - 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 Docker image + uses: docker/build-push-action@v4 + with: + platforms: linux/amd64,linux/arm64/v8 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 22f55ad..ea48d65 100644 --- a/.gitignore +++ b/.gitignore @@ -32,4 +32,6 @@ lerna-debug.log* !.vscode/settings.json !.vscode/tasks.json !.vscode/launch.json -!.vscode/extensions.json \ No newline at end of file +!.vscode/extensions.json + +.env \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index c78b2fd..a9136ef 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,8 +8,19 @@ services: ports: - "8080:8080" environment: - STORAGE_URI: redis://redis:6379 - redis: - image: redis - ports: - - "6379:6379" + STORAGE_URI: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB} + postgres: + image: postgres:12-alpine + # Pass config parameters to the postgres server. + # Find more information below when you need to generate the ssl-relevant file your self + # command: -c ssl=on -c ssl_cert_file=/var/lib/postgresql/server.crt -c ssl_key_file=/var/lib/postgresql/server.key + environment: + PGDATA: /var/lib/postgresql/data/pgdata + POSTGRES_DB: ${POSTGRES_DB:-excalidraw-dev} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + POSTGRES_PORT: ${POSTGRES_PORT:-5432} + POSTGRES_USER: ${POSTGRES_USER} + volumes: + - postgres_data:/var/lib/postgresql/data/pgdata +volumes: + postgres_data: \ No newline at end of file