Skip to content

Commit 33ee63f

Browse files
committed
Simplify generation of standard node images
1 parent 29aa0b9 commit 33ee63f

File tree

13 files changed

+74
-79
lines changed

13 files changed

+74
-79
lines changed

.github/workflows/push-price-pusher-image.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ jobs:
3939
- uses: aws-actions/amazon-ecr-login@v1
4040
id: ecr_login
4141
- run: |
42-
DOCKER_BUILDKIT=1 docker build -t builder -f Dockerfile.builder .
43-
DOCKER_BUILDKIT=1 docker build -t runner -f Dockerfile.runner .
44-
DOCKER_BUILDKIT=1 docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f apps/price_pusher/Dockerfile .
42+
DOCKER_BUILDKIT=1 docker build --build-arg package="@pythnetwork/price-pusher" -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f Dockerfile.node .
4543
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
4644
env:
4745
ECR_REGISTRY: public.ecr.aws

.github/workflows/push-xc-admin-crank-executor-image.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

.github/workflows/push-xc-admin-frontend-image.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ jobs:
2828
password: ${{ secrets.GITHUB_TOKEN }}
2929
- name: Build docker image
3030
run: |
31-
DOCKER_BUILDKIT=1 docker build -t builder -f Dockerfile.builder .
32-
DOCKER_BUILDKIT=1 docker build -t runner -f Dockerfile.runner .
31+
DOCKER_BUILDKIT=1 docker build -t builder-base --target builder-base -f Dockerfile.node .
32+
DOCKER_BUILDKIT=1 docker build -t runner-base --target runner-base -f Dockerfile.node .
3333
DOCKER_BUILDKIT=1 docker build -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} \
3434
--build-arg NEXT_PUBLIC_RPC_POOL_TOKEN=${{ secrets.NEXT_PUBLIC_RPC_POOL_TOKEN }} \
3535
-f governance/xc_admin/packages/xc_admin_frontend/Dockerfile .
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build and Push Cross Chain Admin
2+
on:
3+
push:
4+
tags:
5+
- xc-admin-v*
6+
permissions:
7+
contents: read
8+
id-token: write
9+
packages: write
10+
env:
11+
REGISTRY: ghcr.io
12+
jobs:
13+
xc-admin-image:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Set image tag to version of the git tag
18+
if: ${{ startsWith(github.ref, 'refs/tags/xc-admin-v') }}
19+
run: |
20+
PREFIX="refs/tags/xc-admin-"
21+
VERSION="${GITHUB_REF:${#PREFIX}}"
22+
echo "IMAGE_TAG=${VERSION}" >> "${GITHUB_ENV}"
23+
- name: Log in to the Container registry
24+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
25+
with:
26+
registry: ${{ env.REGISTRY }}
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
- name: Build docker image
30+
run: |
31+
DOCKER_BUILDKIT=1 docker build --build-arg package="@pythnetwork/xc-admin-crank-executor" -t ${{ env.REGISTRY }}/pyth-network/xc-admin-crank-executor:${{ env.IMAGE_TAG }} -f Dockerfile.node .
32+
DOCKER_BUILDKIT=1 docker build --build-arg package="@pythnetwork/xc-admin-crank-pythnet-relayer" -t ${{ env.REGISTRY }}/pyth-network/xc-admin-crank-pythnet-relayer:${{ env.IMAGE_TAG }} -f Dockerfile.node .
33+
DOCKER_BUILDKIT=1 docker build --build-arg package="@pythnetwork/xc-admin-proposer-server" -t ${{ env.REGISTRY }}/pyth-network/xc-admin-proposer-server:${{ env.IMAGE_TAG }} -f Dockerfile.node .
34+
- name: Push docker image
35+
run: |
36+
docker push ${{ env.REGISTRY }}/pyth-network/xc-admin-crank-executor:${{ env.IMAGE_TAG }}
37+
docker push ${{ env.REGISTRY }}/pyth-network/xc-admin-crank-pythnet-relayer:${{ env.IMAGE_TAG }}
38+
docker push ${{ env.REGISTRY }}/pyth-network/xc-admin-proposer-server:${{ env.IMAGE_TAG }}

Dockerfile.builder

Lines changed: 0 additions & 7 deletions
This file was deleted.

Dockerfile.node

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM node:18.20-slim@sha256:1da7652745e9ba5de396e436aa086588ea50d532540fa3147fbc1957c43a46ab as builder-base
2+
WORKDIR /usr/src/pyth
3+
ENV PNPM_HOME="/pnpm"
4+
ENV PATH="$PNPM_HOME:$PATH"
5+
RUN apt-get update && apt-get install -y git python3 make gcc g++ && corepack enable
6+
COPY ./ .
7+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
8+
9+
10+
FROM node:18.20-alpine@sha256:6937be95129321422103452e2883021cc4a96b63c32d7947187fcb25df84fc3f as runner-base
11+
WORKDIR /srv
12+
ENV NODE_ENV production
13+
RUN addgroup --system --gid 1001 pyth && adduser --system --uid 1001 pyth -g pyth && chown pyth:pyth .
14+
USER pyth
15+
16+
17+
FROM builder-base AS builder
18+
ARG package
19+
RUN pnpm exec lerna run build --scope="$package" --include-dependencies
20+
RUN pnpm deploy --filter $package --prod /srv/$package
21+
22+
23+
FROM runner-base AS runner
24+
ARG package
25+
COPY --from=builder --chown=pyth:pyth /srv/${package} ./
26+
CMD [ "npm", "start" ]

Dockerfile.runner

Lines changed: 0 additions & 5 deletions
This file was deleted.

apps/price_pusher/Dockerfile

Lines changed: 0 additions & 11 deletions
This file was deleted.

governance/xc_admin/packages/crank_executor/Dockerfile

Lines changed: 0 additions & 10 deletions
This file was deleted.

governance/xc_admin/packages/crank_executor/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
},
1717
"scripts": {
1818
"build": "tsc",
19+
"start": "node lib/index.js",
1920
"format": "prettier --write \"src/**/*.ts\""
2021
},
2122
"dependencies": {

0 commit comments

Comments
 (0)