Skip to content

Commit

Permalink
Stop use Drone instead use Github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
eitu5ami committed Sep 14, 2022
1 parent 0ae45f9 commit a3d8f25
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 197 deletions.
176 changes: 0 additions & 176 deletions .drone.yml

This file was deleted.

57 changes: 57 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: docker

on:
pull_request:
branches:
- master
push:
branches:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# This is required by aws-actions.
#
permissions:
id-token: write
contents: read

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: hadolint/[email protected]
with:
recursive: true
ignore: DL3018

build:
runs-on: ubuntu-latest
strategy:
matrix:
build:
- dockerfile: event-pipeline-evm/Dockerfile
name: event-pipeline-evm
- dockerfile: event-pipeline/Dockerfile
name: event-pipeline
- dockerfile: staking-api/Dockerfile
name: staking-api
steps:
- uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.AWSROLE }}
aws-region: us-east-1
- uses: aws-actions/amazon-ecr-login@v1
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/build-push-action@v3
with:
push: ${{ github.ref == 'ref/heads/master' && 'true' || 'false' }}
context: .
file: ${{ matrix.build.dockerfile }}
platforms: linux/amd64
tags: ${{ secrets.REGISTRY }}/0x/${{ matrix.build.name }}:${{ github.sha }}
28 changes: 20 additions & 8 deletions event-pipeline-evm/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,38 +1,50 @@
# Stage 1 - Build
FROM node:12-alpine as build
#
FROM node:12-alpine AS build
WORKDIR /usr/src/app

# Install app dependencies
COPY event-pipeline-evm event-pipeline-evm
COPY pipeline-utils pipeline-utils
COPY package.json yarn.lock tsconfig.json lerna.json ./
RUN apk update && \
apk upgrade && \
apk add --no-cache --virtual build-dependencies bash git openssh python3 make g++ && \
yarn --frozen-lockfile --no-cache

RUN yarn build
RUN apk add --update --no-cache --virtual build-dependencies \
bash \
git \
openssh \
python3 \
make \
g++ && \
yarn --frozen-lockfile --no-cache && \
yarn build

# Stage 2
#
FROM node:12-alpine
WORKDIR /usr/src/app

# Setup monorepo
#
COPY package.json yarn.lock tsconfig.json lerna.json ./

# Setup pipeline-utils
#
COPY pipeline-utils/package.json pipeline-utils/
COPY --from=build /usr/src/app/pipeline-utils/lib pipeline-utils/lib

# Install event-pipeline-evm runtime dependencies
#
COPY event-pipeline-evm/package.json event-pipeline-evm/
RUN apk add git && \
RUN apk add --update --no-cache git && \
yarn install --frozen-lockfile --no-cache --production && \
yarn cache clean && \
apk del git

# Copy built files
#
COPY --from=build /usr/src/app/event-pipeline-evm/lib event-pipeline-evm/lib/

#Start
# Start
#
WORKDIR /usr/src/app/event-pipeline-evm
CMD [ "yarn", "migrate_and_start" ]
20 changes: 12 additions & 8 deletions event-pipeline/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
# Stage 1 - Build
FROM node:12-alpine as build
#
FROM node:12-alpine AS build
WORKDIR /usr/src/app

# Install app dependencies
COPY event-pipeline event-pipeline
COPY pipeline-utils pipeline-utils
COPY package.json yarn.lock tsconfig.json lerna.json ./
RUN apk update && \
apk upgrade && \
apk add --no-cache --virtual build-dependencies bash git openssh python3 make g++ && \
yarn --frozen-lockfile --no-cache

RUN yarn build
RUN apk add --update --no-cache --virtual build-dependencies bash git openssh python3 make g++ && \
yarn --frozen-lockfile --no-cache && \
yarn build

# Stage 2
FROM node:12-alpine
Expand All @@ -26,9 +25,14 @@ COPY --from=build /usr/src/app/pipeline-utils/lib pipeline-utils/lib

# Install event-pipeline runtime dependencies
COPY event-pipeline/package.json event-pipeline/
RUN apk add git python3 make g++ && \
RUN apk add --update --no-cache --virtual build-dependencies \
git \
python3 \
make \
g++ && \
yarn install --frozen-lockfile --no-cache --production && \
apk del git python3 make g++
apk del build-dependencies && \
yarn cache clean

# Copy built files
COPY --from=build /usr/src/app/event-pipeline/lib event-pipeline/lib/
Expand Down
18 changes: 13 additions & 5 deletions staking-api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
# Stage 1
FROM node:12-alpine as build

WORKDIR /usr/src/app
# Install app dependencies
COPY staking-api staking-api
COPY package.json yarn.lock tsconfig.json lerna.json ./
RUN apk update && \
apk upgrade && \
apk add --no-cache --virtual build-dependencies bash git openssh python3 make g++ && \

RUN apk add --update --no-cache --virtual build-dependencies \
bash \
git \
openssh \
python3 \
make \
g++ && \
yarn --frozen-lockfile --no-cache

RUN yarn build

# Stage 2
Expand All @@ -20,7 +26,9 @@ ENV NODE_ENV=production

# Install runtime dependencies
COPY staking-api/package.json yarn.lock ./
RUN yarn install --frozen-lockfile --no-cache

RUN yarn install --frozen-lockfile && \
yarn cache clean

# Copy built files
COPY --from=build /usr/src/app/staking-api/lib /usr/src/app/staking-api/lib
Expand Down

0 comments on commit a3d8f25

Please sign in to comment.