Skip to content

Commit

Permalink
Merge branch 'support-PI' into 'dev'
Browse files Browse the repository at this point in the history
support docker images for PIs

Closes operation#11

See merge request ergo/rosen-bridge/ui!193
  • Loading branch information
vorujack committed Apr 25, 2024
2 parents 3709c0e + f80f14e commit ce563d6
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 37 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/docker-dev-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ ubuntu-latest ]
apps:
- watcher
- guard
Expand All @@ -21,11 +22,24 @@ jobs:
with:
fetch-depth: 0

- name: Build dependencies
run: |
npm ci
npm run build --workspace packages/constants
npm run build --workspace packages/types
npm run build --workspace packages/utils
npm run build --workspace packages --if-present
- name: Move Config Files
run: |
mv docker/nginx.conf ./
mv docker/entrypoint.sh ./
- name: Build App
run: |
cd ./apps/${{ matrix.apps }}
npm run build
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
Expand Down
41 changes: 28 additions & 13 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,42 @@ jobs:
name: Build and Push Docker Image
permissions: write-all
runs-on: ubuntu-latest
strategy:
matrix:
os: [ ubuntu-latest ]

steps:
- name: Checkout the Code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Build dependencies
run: |
npm ci
npm run build --workspace packages/constants
npm run build --workspace packages/types
npm run build --workspace packages/utils
npm run build --workspace packages --if-present
- name: Move Config Files
run: |
mv docker/nginx.conf ./
mv docker/entrypoint.sh ./
- name: Build App
id: build-app
run: |
if [[ ${{ github.ref }} =~ ^refs/tags/watcher-app-* ]]; then
cd ./apps/watcher
npm run build
echo "appName=watcher" >> $GITHUB_OUTPUT
elif [[ ${{ github.ref }} =~ ^refs/tags/guard-app-* ]]; then
cd ./apps/guard
npm run build
echo "appName=guard" >> $GITHUB_OUTPUT
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
Expand All @@ -37,30 +61,21 @@ jobs:
username: rosen-bridge
password: ${{ secrets.GITHUB_TOKEN }}

- name: Check Tag
id: check-tag
run: |
if [[ ${{ github.ref }} =~ ^refs/tags/watcher-app-* ]]; then
echo "appName=watcher" >> $GITHUB_OUTPUT
elif [[ ${{ github.ref }} =~ ^refs/tags/guard-app-* ]]; then
echo "appName=guard" >> $GITHUB_OUTPUT
fi
- name: Docker Metadata action
uses: docker/metadata-action@v5
if: steps.check-tag.outputs.appName != null
if: steps.build-app.outputs.appName != null
id: meta
with:
images: ghcr.io/rosen-bridge/ui-${{ steps.check-tag.outputs.appName }}
images: ghcr.io/rosen-bridge/ui-${{ steps.build-app.outputs.appName }}
tags: |
type=match,pattern=\d.\d.\d
- name: Build and push
uses: docker/build-push-action@v4
if: steps.check-tag.outputs.appName != null
if: steps.build-app.outputs.appName != null
with:
context: .
platforms: ${{ vars.PLATFORM_LIST || 'linux/amd64' }}
push: true
tags: ${{ steps.meta.outputs.tags }}
target: ${{ steps.check-tag.outputs.appName }}
target: ${{ steps.build-app.outputs.appName }}
26 changes: 2 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,8 @@
FROM node:18.17.0 AS builder
WORKDIR /app
COPY package*.json .nvmrc .prettierrc ./
COPY packages ./packages
RUN npm ci
RUN npm run build --workspace packages/constants
RUN npm run build --workspace packages/types
RUN npm run build --workspace packages/utils
RUN npm run build --workspace packages --if-present

FROM builder AS watcher-builder
COPY apps/watcher ./apps/watcher
RUN npm ci
WORKDIR /app/apps/watcher
RUN npm run build

FROM builder AS guard-builder
COPY apps/guard ./apps/guard
RUN npm ci
WORKDIR /app/apps/guard
RUN npm run build

FROM nginx:1.25 AS watcher
LABEL maintainer="rosen-bridge team <team@rosen.tech>"
LABEL description="Docker image for the front-end of watcher owned by rosen-bridge organization."
LABEL org.label-schema.vcs-url="https://github.com/rosen-bridge/ui"
COPY --from=watcher-builder /app/apps/watcher/out/ /usr/share/nginx/html
COPY ./apps/watcher/out/ /usr/share/nginx/html
COPY nginx.conf /etc/nginx/nginx.conf
COPY entrypoint.sh ./
ENV SERVICE_NAME=service
Expand All @@ -35,7 +13,7 @@ FROM nginx:1.25 AS guard
LABEL maintainer="rosen-bridge team <team@rosen.tech>"
LABEL description="Docker image for the front-end of guard owned by rosen-bridge organization."
LABEL org.label-schema.vcs-url="https://github.com/rosen-bridge/ui"
COPY --from=guard-builder /app/apps/guard/out/ /usr/share/nginx/html
COPY ./apps/guard/out/ /usr/share/nginx/html
COPY nginx.conf /etc/nginx/nginx.conf
COPY entrypoint.sh ./
ENV SERVICE_NAME=service
Expand Down

0 comments on commit ce563d6

Please sign in to comment.