-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for docker builds (#371)
* Add support for docker builds * update UI nginx config * Add ci job * Update gh actions files * update actions versions * add docker-compose * fix project name * fix workdir * test building docker * Move workflow to github actions (#375) * test gh actions file * test new gh workflow * test running services * add actions cache * cleanup jobs * add test jobs * update ci job * expose docker port * test different node image * set env to qa * add contracts deploy * update workflow * Cleanup job names * add bb testing * Update bb version * clear branches filter * Rm bb run due to job being stuck on db conn * test without configs * Disable bb server tests * revert local-deps override * Remove local-deps * debug ci job * update pgsql service * Release complete pipeline * cleanup * revert changes * Update docker images workflow * add export to docker * Update workflow * test docker builds * forcefully assign builder * temp remove arm64 image * compile contracts before dockerbuild * update images * Update dockerfiles * Updates
- Loading branch information
Showing
11 changed files
with
501 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
Dockerfile | ||
.git | ||
Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Snowpack dependency directory (https://snowpack.dev/) | ||
web_modules/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
.parcel-cache | ||
|
||
# Next.js build output | ||
.next | ||
out | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and not Next.js | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# public | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port | ||
|
||
# Stores VSCode versions used for testing VSCode extensions | ||
.vscode-test | ||
|
||
# yarn v2 | ||
.yarn/cache | ||
.yarn/unplugged | ||
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp. | ||
|
||
|
||
# clj-kondo cache | ||
.clj-kondo/.cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,27 +2,110 @@ name: Docker Image CI | |
|
||
on: | ||
push: | ||
branches: [ "add_dockerfiles", "newlance" ] | ||
branches: [ "master", "main", "newlance"] | ||
pull_request: | ||
branches: [ "add_dockerfiles", "newlance" ] | ||
|
||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
run_tests: | ||
runs-on: ubuntu-latest | ||
name: Run tests | ||
env: | ||
ETHLANCE_ENV: qa | ||
services: | ||
ipfs-daemon: | ||
image: district0x/ipfs-daemon:latest | ||
postgres: | ||
image: postgres:latest | ||
ports: | ||
- 5432:5432 | ||
env: | ||
POSTGRES_PASSWORD: pass | ||
POSTGRES_USER: ethlanceuser | ||
POSTGRES_DB: ethlance-test | ||
# Set health checks to wait until postgres has started | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
steps: | ||
- name: Checkout ethlance code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Checkout ethlance-configs repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: district0x/ethlance-config | ||
path: ethlance-config | ||
token: ${{ secrets.ETHLANCE_CONFIG_PAT }} | ||
ref: docker_build | ||
|
||
- name: Run ganache service | ||
run: | | ||
docker run --rm -d --name ganache -p 8550:8550 trufflesuite/ganache:v7.9.1 -v -m "easy leave proof verb wait patient fringe laptop intact opera slab shine" -p 8550 -b 0.5 --chain.allowUnlimitedContractSize=true | ||
- name: Restore Top level cache directory for Ethlance | ||
uses: actions/cache@v3 | ||
id: yarn-cache-top-level | ||
with: | ||
path: ./node_modules | ||
key: ${{ runner.os }}-ethlance-top-level-yarn-${{ hashFiles('yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-ethlance-top-level-yarn- | ||
- name: Install ethlance top-level node modules | ||
run: | | ||
yarn install | ||
- name: Restore Server cache directory for Ethlance | ||
uses: actions/cache@v3 | ||
id: yarn-cache-server | ||
with: | ||
path: ./server/node_modules | ||
key: ${{ runner.os }}-ethlance-server-yarn-${{ hashFiles('server/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-ethlance-server-yarn- | ||
- name: Install ethlance server node modules | ||
run: | | ||
cd server | ||
yarn install | ||
cd .. | ||
- name: Deploy contracts to ganache-test | ||
run: | | ||
npx truffle migrate --network ganache-test --reset | ||
- name: Setup Babashka | ||
uses: turtlequeue/[email protected] | ||
with: | ||
babashka-version: 1.3.186 | ||
|
||
- name: Check bb version | ||
run: bb --version | ||
|
||
- name: Run server tests | ||
run: bb run-server-tests | ||
|
||
- name: Stop Ganache service | ||
run: docker rm -f ganache | ||
|
||
docker_build: | ||
name: Build images and deploy contracts | ||
needs: run_tests | ||
strategy: | ||
matrix: | ||
image: ["server", "ui"] | ||
env: ["qa"] | ||
permissions: | ||
contents: read # for actions/checkout to fetch code | ||
name: Docker Build | ||
contents: read | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout ethlance code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Checkout ethlance-configs repo | ||
uses: actions/checkout@v4 | ||
with: | ||
|
@@ -35,30 +118,61 @@ jobs: | |
run: | | ||
cp -r ethlance-config/config . | ||
ls -lah config/ | ||
# - name: Set up QEMU | ||
# uses: docker/setup-qemu-action@v2 | ||
|
||
# - name: Set up Docker Buildx | ||
# uses: docker/setup-buildx-action@v2 | ||
|
||
# - name: Configure AWS Credentials | ||
# uses: aws-actions/configure-aws-credentials@v1 | ||
# with: | ||
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
# aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | ||
|
||
# - name: Login to Amazon ECR | ||
# id: login-ecr | ||
# uses: aws-actions/amazon-ecr-login@v1 | ||
|
||
# - name: Build and push | ||
# uses: docker/build-push-action@v4 | ||
# with: | ||
# context: . | ||
# platforms: linux/amd64,linux/arm64 | ||
# file: docker-builds/${{ matrix.image }}/Dockerfile | ||
# build-args: BUILD_ENV=${{ matrix.env }} | ||
# push: true | ||
# tags: ${{ secrets.ECR_REGISTRY }}/streamtide-${{ matrix.image }}:latest-${{ matrix.env }} | ||
- name: Restore Top level cache directory for Ethlance | ||
uses: actions/cache@v3 | ||
id: yarn-cache-top-level | ||
with: | ||
path: ./node_modules | ||
key: ${{ runner.os }}-ethlance-top-level-yarn-${{ hashFiles('yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-ethlance-top-level-yarn- | ||
- name: Install ethlance top-level node modules | ||
run: | | ||
yarn install | ||
- name: Deploy contracts for ${{ matrix.env }} | ||
run: | | ||
ETHLANCE_ENV=${{ matrix.env }} npx truffle migrate --network ethlance.mad.is-testnet --reset | ||
- name: Set up QEMU | ||
id: setup-qemu | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
id: setup-buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | ||
|
||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v2 | ||
|
||
- name: Build and push UI | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
platforms: linux/amd64 | ||
builder: ${{ steps.setup-buildx.outputs.name }} | ||
file: docker-builds/ui/Dockerfile | ||
build-args: BUILD_ENV=${{ matrix.env }} | ||
push: true | ||
tags: ${{ secrets.ECR_REGISTRY }}/ethlance-ui:latest-${{ matrix.env }} | ||
|
||
- name: Build and push Server | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
builder: ${{ steps.setup-buildx.outputs.name }} | ||
platforms: linux/amd64 | ||
file: docker-builds/server/Dockerfile | ||
build-args: BUILD_ENV=${{ matrix.env }} | ||
push: true | ||
tags: ${{ secrets.ECR_REGISTRY }}/ethlance-server:latest-${{ matrix.env }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ designs/deploy | |
tags | ||
temp | ||
release | ||
config |
Oops, something went wrong.