Skip to content

Commit

Permalink
update docker to build from root of workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
guplersaxanoid committed Oct 31, 2023
1 parent 1f17d2b commit 4b9335f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 18 deletions.
31 changes: 17 additions & 14 deletions .github/workflows/node-docker.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: "Node-to-docker"
on:
push:
branches:
- docker-from-source
release:
types:
- published
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand Down
14 changes: 10 additions & 4 deletions packages/node/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"]

0 comments on commit 4b9335f

Please sign in to comment.