Merge pull request #1 from kitsteam/add-release-workflow

This commit is contained in:
JannikStreek 2023-12-21 17:33:48 +01:00 committed by GitHub
commit 503309b40b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 1970 additions and 5835 deletions

3
.env.default Normal file
View File

@ -0,0 +1,3 @@
POSTGRES_USER=excalidraw-user
POSTGRES_PASSWORD=
POSTGRES_DB=excalidraw-dev

54
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,54 @@
# 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
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: 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:
target: production
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

4
.gitignore vendored
View File

@ -32,4 +32,6 @@ lerna-debug.log*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/extensions.json
.env

View File

@ -1,4 +1,4 @@
FROM node:18-bullseye-slim
FROM node:18-bullseye-slim as base
RUN apt-get update && apt-get install -y make g++ python3
RUN ln -sf /usr/bin/python3 /usr/bin/python
@ -6,6 +6,7 @@ RUN ln -sf /usr/bin/python3 /usr/bin/python
RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
WORKDIR /home/node/app
FROM base as production
COPY package*.json ./
USER node
@ -17,3 +18,6 @@ RUN npm run build
EXPOSE 8080
ENTRYPOINT ["npm", "run", "start:prod"]
FROM base as development
USER node

View File

@ -2,14 +2,29 @@ version: "3.8"
services:
excalidraw-storage-backend:
build: .
build:
context: .
target: production
tty: true
stdin_open: true
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}
volumes:
- .:/home/node/app
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:

7706
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -21,11 +21,8 @@
"test:e2e": "jest --config ./test/jest-e2e.json"
},
"dependencies": {
"@keyv/mongo": "^1.2.1",
"@keyv/mysql": "^1.1.5",
"@keyv/postgres": "^1.0.17",
"@keyv/redis": "^2.2.0",
"@keyv/sqlite": "^2.0.3",
"@nestjs/common": "^8.0.0",
"@nestjs/core": "^8.0.0",
"@nestjs/platform-express": "^8.0.0",
@ -37,7 +34,7 @@
"rxjs": "^7.2.0"
},
"devDependencies": {
"@nestjs/cli": "^8.0.0",
"@nestjs/cli": "^8.2.8",
"@nestjs/schematics": "^8.0.0",
"@nestjs/testing": "^8.0.0",
"@types/express": "^4.17.13",