Skip to content

Commit

Permalink
Simplify images, upload multi-arch images, pipeline updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Rogerson committed Jul 27, 2023
1 parent d614244 commit 5b2bf41
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 38 deletions.
42 changes: 26 additions & 16 deletions .github/workflows/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: "ethereum-writer-deployer"
on:
push:
branches:
- '**'
- '**'
release:
types: [ published ]

Expand All @@ -26,14 +26,21 @@ jobs:
- run: docker --version
- run: python --version
- run: env
- name: Run npm install
run: npm install
- name: Run npm ci
run: npm ci
- run: npm run build
# Unit tests
- run: npm install --no-save tap-xunit
- run: mkdir -p _out/unit _out/e2e
- run: npm test -- --timeout=1m
- run: npm run build
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: build
path: ./dist

build-and-release-to-staging:
release-to-staging:
needs: build-and-test
runs-on: ubuntu-latest
steps:
- name: Check out repository
Expand All @@ -46,14 +53,17 @@ jobs:
node-version: 16
- name: setup-docker
uses: docker-practice/actions-setup-docker@master
- run: ./boyar/create-version-file.sh
- name: Run npm install
run: npm install
- run: ./boyar/docker-build.sh
- name: release-to-docker-hub-staging
env:
DOCKER_HUB_IMAGE_PATH: orbsnetworkstaging/ethereum-writer
DOCKER_HUB_LOGIN: ${{ secrets.DOCKER_HUB_STAGING_LOGIN }}
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_STAGING_PASSWORD }}
run: ./.github/release-to-staging.sh

- name: Download build artifact
uses: actions/download-artifact@v3
with:
name: build
path: ./dist
- name: Generate version
run: ./create-version-file.sh
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_STAGING_LOGIN }}
password: ${{ secrets.DOCKER_HUB_STAGING_PASSWORD }}
- name: Build and push image
run: docker buildx build --platform linux/amd64,linux/arm64 -t orbsnetworkstaging/ethereum-writer:$(cat .version) --push .
15 changes: 8 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,22 @@ WORKDIR /opt/orbs
COPY package*.json ./
COPY .version ./version

RUN apk add --no-cache git
# Add daemontools as a requirement from the ethereum-writer Dockerfile
RUN apk add --no-cache git daemontools --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing

# see https://github.com/nodejs/docker-node/issues/282

# --no-cache: download package index on-the-fly, no need to cleanup afterwards
# --virtual: bundle packages, remove whole bundle at once, when done
RUN apk --no-cache --virtual build-dependencies add \
python3 \
make \
g++ \
&& npm install \
&& apk del build-dependencies

RUN npm install
COPY ./healthcheck/healthcheck ./
COPY ./healthcheck/healthcheck.js ./
COPY ./healthcheck/entrypoint.sh /opt/orbs/service

HEALTHCHECK CMD /opt/orbs/healthcheck

COPY dist ./dist

CMD [ "npm", "start" ]
CMD [ "npm", "start" ]
9 changes: 0 additions & 9 deletions boyar/Dockerfile

This file was deleted.

4 changes: 0 additions & 4 deletions boyar/docker-build.sh

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"pretest": "npm run typecheck && npm run lint",
"clean": "rimraf ./dist/",
"prebuild": "npm run clean",
"build": "tsc --skipLibCheck -p ./tsconfig.prod.json && ./boyar/create-version-file.sh && docker build -t local/ethereum-writer .",
"build": "tsc --skipLibCheck -p ./tsconfig.prod.json && ./create-version-file.sh && docker build -t local/ethereum-writer .",
"build:quick": "tsc --skipLibCheck -p ./tsconfig.prod.json",
"test": "ava --verbose --serial",
"test:quick": "echo '-- TEST --' && ava --verbose",
Expand Down Expand Up @@ -65,4 +65,4 @@
"web3": "1.2.6",
"yargs": "^15.3.1"
}
}
}

0 comments on commit 5b2bf41

Please sign in to comment.