Skip to content

Commit

Permalink
feat(workflow): docker-buildx workflow (#1070)
Browse files Browse the repository at this point in the history
* add initial sanity testing container

* remove legacy test

* use base docker file as root context

* adding just the root apps workflow

* add document ignore to speed up build time with less context to transfer

* remove sanity check first

* build all instead

* add build-args instead of building multiple images

Co-authored-by: Kodemon <[email protected]>
  • Loading branch information
fuxingloh and kodemon authored Feb 17, 2022
1 parent a8b0690 commit 71bbd9d
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 1 deletion.
11 changes: 11 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.idea
.husky
.github
docs
examples

node_modules

__tests__
dist
tsconfig.build.tsbuildinfo
24 changes: 23 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
strategy:
fail-fast: false
matrix:
instance: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
instance: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
env:
GH_INSTANCE_TOTAL: 10
steps:
Expand Down Expand Up @@ -61,3 +61,25 @@ jobs:

- run: npm ci
- run: npx --no-install eslint .

docker-buildx:
name: Docker Buildx
runs-on: ubuntu-latest
strategy:
matrix:
platform: [ linux/amd64, linux/arm64 ]
app: [ legacy-api, ocean-api ]
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@27d0a4f181a40b142cce983c5393082c365d1480

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@94ab11c41e45d028884a99163086648e898eed25

- name: Build platforms
uses: docker/build-push-action@7f9d37fa544684fb73bfe4835ed7214c255ce02b
with:
push: false
build-args: APP=${{ matrix.app }}
platforms: ${{ matrix.platform }}
tags: ghcr.io/defich/${{ matrix.app }}:latest
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM node:16-alpine3.13

# Add curl to use docker healthcheck capability
RUN apk --no-cache add curl

WORKDIR /app

COPY LICENSE ./

COPY lerna.json ./
COPY tsconfig.base.json ./
COPY tsconfig.build.json ./
COPY tsconfig.json ./

COPY package.json ./
COPY package-lock.json ./

COPY packages ./packages
COPY apps ./apps

RUN npm ci
RUN npx lerna run build --ignore @defichain-apps/website

ARG APP
ENV APP ${APP}
RUN ln -s apps/${APP}/dist/apps/${APP}/src ${APP}

CMD "node" ${APP}

0 comments on commit 71bbd9d

Please sign in to comment.