diff --git a/.github/workflows/node-docker.yml b/.github/workflows/node-docker.yml index 6491c581c9..b42438cfb6 100644 --- a/.github/workflows/node-docker.yml +++ b/.github/workflows/node-docker.yml @@ -1,5 +1,8 @@ name: "Node-to-docker" on: + push: + branches: + - docker-from-source release: types: - published @@ -43,23 +46,23 @@ jobs: run: | sh .github/workflows/scripts/nodeVersion.sh - - name: Set execute permissions for the script - run: chmod +x .github/workflows/scripts/replace-versions.sh + #- name: Set execute permissions for the script + # run: chmod +x .github/workflows/scripts/replace-versions.sh # Replace workspace:* with actual versions - - name: Replace workspace dependencies with actual versions - run: | - ./.github/workflows/scripts/replace-versions.sh + #- name: Replace workspace dependencies with actual versions + # run: | + # ./.github/workflows/scripts/replace-versions.sh - name: Build and push - if: github.event_name == 'workflow_dispatch' && github.event.inputs.isLatest == 'false' + if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.isLatest == 'false') uses: docker/build-push-action@v2 with: context: . push: true platforms: arm64,amd64 file: ./packages/node/Dockerfile - tags: onfinality/subql-node + tags: onfinality/subql-node:dockertest build-args: RELEASE_VERSION=${{ steps.get-node-version.outputs.NODE_VERSION }} - name: Build and push @@ -112,23 +115,23 @@ jobs: run: | sh .github/workflows/scripts/nodeVersion.sh - - name: Set execute permissions for the script - run: chmod +x .github/workflows/scripts/replace-versions.sh + #- name: Set execute permissions for the script + # run: chmod +x .github/workflows/scripts/replace-versions.sh # Replace workspace:* with actual versions - - name: Replace workspace dependencies with actual versions - run: | - ./.github/workflows/scripts/replace-versions.sh + #- name: Replace workspace dependencies with actual versions + # run: | + # ./.github/workflows/scripts/replace-versions.sh - name: Build and push - if: github.event_name == 'workflow_dispatch' && github.event.inputs.isLatest == 'false' + if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.isLatest == 'false') uses: docker/build-push-action@v2 with: context: . push: true platforms: arm64,amd64 file: ./packages/node/Dockerfile - tags: subquerynetwork/subql-node-substrate, + tags: subquerynetwork/subql-node-substrate:dockertest, - name: Build and push if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.isLatest == 'true') diff --git a/packages/node/Dockerfile b/packages/node/Dockerfile index 94ef3e5c75..1211f69ef5 100644 --- a/packages/node/Dockerfile +++ b/packages/node/Dockerfile @@ -2,10 +2,16 @@ FROM node:18 as builder WORKDIR /app -COPY ./packages/node ./ +COPY ./ ./ RUN npm install -g --force yarn@latest -RUN yarn pack -o /app.tgz + +RUN yarn install +RUN yarn build + +WORKDIR /app/packages/node + +RUN yarn pack --filename ./app.tgz # Production stage @@ -14,10 +20,10 @@ ENV TZ utc RUN apk add --no-cache tini git curl tar -COPY --from=builder /app/*.tgz /app.tgz +COPY --from=builder /app/packages/node/app.tgz /app.tgz RUN tar -xzvf /app.tgz --strip 1 && rm /app.tgz RUN yarn install -ENTRYPOINT ["/sbin/tini", "--", "node", "bin/run"] +ENTRYPOINT ["/sbin/tini", "--", "bin/run"] CMD ["-f","/app"] \ No newline at end of file