From 1cc9657673a04c5903a2ea5f6c05ea0b15d596d4 Mon Sep 17 00:00:00 2001 From: Jakub Balinski <31112335+balins@users.noreply.github.com> Date: Thu, 16 May 2024 18:10:40 +0200 Subject: [PATCH 1/2] add `room-manager` example dockerfile --- .dockerignore | 133 +++++++++++++++++++++++++++++++ examples/room-manager/Dockerfile | 21 +++++ 2 files changed, 154 insertions(+) create mode 100644 .dockerignore create mode 100644 examples/room-manager/Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..32e1afe --- /dev/null +++ b/.dockerignore @@ -0,0 +1,133 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional stylelint cache +.stylelintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# vuepress v2.x temp and cache directory +.temp +.cache + +# Docusaurus cache and generated files +.docusaurus + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + +# Documentation +docs/ diff --git a/examples/room-manager/Dockerfile b/examples/room-manager/Dockerfile new file mode 100644 index 0000000..a6b0a34 --- /dev/null +++ b/examples/room-manager/Dockerfile @@ -0,0 +1,21 @@ +# NOTE: This Dockerfile needs to be built from the context of root of the repository +FROM node:20 + +# Step 1: Install SDK +WORKDIR /app + +COPY package.json package-lock.json ./ + +# Ignore scripts - postpone the prepare script until the source code is copied +RUN npm ci --ignore-scripts + +COPY . . + +RUN npm run prepare + +# Step 2: Install and run the example +WORKDIR /app/examples/room-manager + +RUN npm ci + +CMD ["npm", "start"] From ae14b782100e920be9d23885dc14980aa5ecb8fb Mon Sep 17 00:00:00 2001 From: Jakub Balinski <31112335+balins@users.noreply.github.com> Date: Fri, 17 May 2024 11:36:00 +0200 Subject: [PATCH 2/2] add `deploy-room-manager` workflow --- .github/workflows/deploy-room-manager.yaml | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/deploy-room-manager.yaml diff --git a/.github/workflows/deploy-room-manager.yaml b/.github/workflows/deploy-room-manager.yaml new file mode 100644 index 0000000..5c8a07a --- /dev/null +++ b/.github/workflows/deploy-room-manager.yaml @@ -0,0 +1,32 @@ +name: Deploy Room Manager + +on: + push: + branches: [main] + + workflow_dispatch: + +jobs: + cd: + runs-on: self-hosted + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Build Room Manager example + run: docker build -f examples/room-manager/Dockerfile -t gh-runner-room-manager . + + - name: Clean up the previous Room Manager container + run: docker rm -f gh-runner-room-manager + + - name: Run Room Manager example + run: | + docker run -d -p 8080:8080 \ + --name gh-runner-room-manager \ + -e PORT=8080 \ + -e PEERLESS_PURGE_TIMEOUT=600 \ + -e FISHJAM_URL=${{ secrets.ROOM_MANAGER_FISHJAM_URL }} \ + -e FISHJAM_SERVER_TOKEN=${{ secrets.ROOM_MANAGER_FISHJAM_SERVER_TOKEN }} \ + -e WEBHOOK_URL=${{ secrets.ROOM_MANAGER_WEBHOOK_URL }} \ + gh-runner-room-manager