Kaynağa Gözat

Docker build adjustments (#107)

* Docker build adjustments

* Prettier fix

* Rename default tag to `joystream/orion`
Leszek Wiesner 1 yıl önce
ebeveyn
işleme
289d1ae0e6
6 değiştirilmiş dosya ile 46 ekleme ve 10 silme
  1. 1 0
      .dockerignore
  2. 18 2
      .github/workflows/checks.yml
  3. 22 0
      .github/workflows/docker.yml
  4. 2 0
      Dockerfile
  5. 2 7
      Makefile
  6. 1 1
      package.json

+ 1 - 0
.dockerignore

@@ -2,3 +2,4 @@
 /node_modules
 /lib
 /*Versions.jsonl
+/db/persisted

+ 18 - 2
.github/workflows/checks.yml

@@ -2,8 +2,8 @@ name: Checks
 on: [push, pull_request]
 
 jobs:
-  checks:
-    name: Checks
+  local:
+    name: Local build, linting and formatting
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
@@ -20,3 +20,19 @@ jobs:
         run: npm ci
       - name: Run checks
         run: npm run checks
+  docker:
+    name: Docker build check
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        os: [ubuntu-latest]
+        node-version: [16.x]
+      fail-fast: true
+    steps:
+      - uses: actions/checkout@v2
+      - name: Use Node.js ${{matrix.node-version}}
+        uses: actions/setup-node@v1
+        with:
+          node-version: ${{matrix.node-version}}
+      - name: Build docker image
+        run: make build-docker

+ 22 - 0
.github/workflows/docker.yml

@@ -0,0 +1,22 @@
+name: Build and publish to Docker Hub
+
+on:
+  push:
+    branches:
+      - 'master'
+
+jobs:
+  docker:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Login to DockerHub
+        uses: docker/login-action@v1
+        with:
+          username: ${{ secrets.DOCKERHUB_USERNAME }}
+          password: ${{ secrets.DOCKERHUB_TOKEN }}
+      - name: Build and push
+        id: docker_build
+        uses: docker/build-push-action@v2
+        with:
+          push: true
+          tags: joystream/orion:latest

+ 2 - 0
Dockerfile

@@ -11,6 +11,8 @@ ADD assets assets
 RUN npm ci
 ADD tsconfig.json .
 ADD src src
+ADD schema schema
+RUN npx squid-typeorm-codegen
 RUN npm run build
 
 FROM node-with-gyp AS deps

+ 2 - 7
Makefile

@@ -7,13 +7,8 @@ install:
 build:
 	@npm run build
 
-build-processor-image:
-	@docker build . --target processor -t orion-processor
-
-build-query-node-image:
-	@docker build . --target query-node -t orion-api
-
-build-images: build-processor-image build-query-node-image
+build-docker:
+	@docker build . -t joystream/orion
 
 serve:
 	@npx squid-graphql-server --subscriptions

+ 1 - 1
package.json

@@ -12,7 +12,7 @@
     "checks": "prettier --check . && npm run lint && make codegen && tsc --noEmit --pretty",
     "db:migrate": "npx squid-typeorm-migration apply",
     "processor-start": "node lib/processor.js",
-    "query-node-start": "NODE_ENV=production patch-package --patch-dir assets/patches && squid-graphql-server --subscriptions --max-response-size 10000 --dumb-cache in-memory --dumb-cache-ttl 1000 --dumb-cache-size 100 --dumb-cache-max-age 1000",
+    "query-node-start": "NODE_ENV=production patch-package --patch-dir assets/patches && squid-graphql-server --subscriptions",
     "postinstall": "patch-package --patch-dir assets/patches",
     "tests:codegen": "npx graphql-codegen -c ./src/tests/v1/codegen.yml && npx graphql-codegen -c ./src/tests/v2/codegen.yml",
     "tests:compareState": "npx ts-node ./src/tests/compareState.ts",