-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat/30 refactor operational packages (#116)
* refactor Operational packages * fix: refactor operations package to use oclif * adjusting Dockerfile * adjusting github action * Update all-tools.yml Signed-off-by: Andrei A. <andrei.alexandru@consensys.net> * adjusting github action --------- Signed-off-by: Andrei A. <andrei.alexandru@consensys.net> Co-authored-by: VGau <victorien.gauch@consensys.net>
- Loading branch information
Showing
52 changed files
with
3,169 additions
and
26,035 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 |
---|---|---|
|
@@ -24,7 +24,7 @@ | |
.run/**.run.xml | ||
.envrc | ||
bin/ | ||
!operations/src/synctx/bin/ | ||
!operations/bin/ | ||
target/ | ||
tmp/ | ||
build/ | ||
|
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
dist | ||
node_modules | ||
src/synctx/ | ||
coverage |
File renamed without changes.
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
dist | ||
node_modules | ||
src/synctx/ | ||
coverage |
File renamed without changes.
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 |
---|---|---|
@@ -1,59 +1,31 @@ | ||
# syntax=docker/dockerfile:1.2 | ||
FROM node:18-slim AS builder | ||
FROM node:20-slim AS base | ||
|
||
ENV PNPM_HOME="/pnpm" | ||
ENV PATH="$PNPM_HOME:$PATH" | ||
|
||
RUN corepack enable | ||
|
||
FROM base AS builder | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml tsconfig.json ./ | ||
COPY ./operations/package.json ./operations/package.json | ||
|
||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile --prefer-offline && npm install -g typescript | ||
|
||
COPY . . | ||
|
||
RUN rm -rf src/synctx && pnpm run -F operations build | ||
|
||
FROM node:18-slim AS builder-synctx | ||
|
||
ARG TARGETPLATFORM | ||
|
||
WORKDIR /opt/synctx | ||
COPY operations/ ./operations/ | ||
|
||
COPY ./operations/src/synctx . | ||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile --prefer-offline --ignore-scripts | ||
RUN pnpm run -F operations build | ||
RUN pnpm deploy --filter=./operations --prod ./prod | ||
|
||
RUN apt-get update \ | ||
&& apt-get install --no-install-recommends -y git xz-utils perl \ | ||
&& OCLIF_TARGET=$(echo ${TARGETPLATFORM} | sed 's#/#-#;s#amd64#x64#') \ | ||
&& yarn global add oclif && yarn && yarn run build && yarn install --production --ignore-scripts --prefer-offline \ | ||
&& git init \ | ||
&& git config user.email "sre@consensys.net" \ | ||
&& git config user.name "cs-sre" \ | ||
&& git commit --allow-empty -m "dummy commit" \ | ||
&& oclif pack tarballs --targets="${OCLIF_TARGET}" \ | ||
&& tar -xvf dist/synctx-*.tar.gz | ||
|
||
FROM node:18-slim AS release | ||
FROM node:20-slim AS release | ||
|
||
ENV NODE_ENV=production | ||
ENV PATH="${PATH}:/opt/synctx/bin" | ||
|
||
WORKDIR /usr/src/app | ||
|
||
# Install pnpm | ||
ENV PNPM_HOME="/pnpm" | ||
ENV PATH="$PNPM_HOME:$PATH" | ||
RUN corepack enable | ||
|
||
COPY package.json pnpm-lock.yaml ./ | ||
|
||
RUN pnpm install --prod --frozen-lockfile --prefer-offline | ||
|
||
COPY --chown=node:node --from=builder /usr/src/app/operations/dist ./dist | ||
COPY --chown=node:node --from=builder-synctx /opt/synctx/synctx /opt/synctx/ | ||
USER node | ||
|
||
USER node:node | ||
COPY --from=builder /usr/src/app/prod ./ | ||
|
||
ENTRYPOINT ["node"] | ||
ENTRYPOINT ["./bin/run.js"] |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
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,6 @@ | ||
#!/usr/bin/env -S node --loader ts-node/esm --disable-warning=ExperimentalWarning | ||
|
||
// eslint-disable-next-line n/shebang | ||
import {execute} from '@oclif/core' | ||
|
||
await execute({development: true, dir: import.meta.url}) |
File renamed without changes.
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,5 @@ | ||
#!/usr/bin/env node | ||
|
||
import {execute} from '@oclif/core' | ||
|
||
await execute({dir: import.meta.url}) |
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,18 @@ | ||
module.exports = { | ||
preset: "ts-jest/presets/default-esm", | ||
testEnvironment: "node", | ||
testRegex: "test.ts$", | ||
transform: { | ||
"^.+\\.ts$": ["ts-jest", { useESM: true }], | ||
}, | ||
verbose: true, | ||
collectCoverage: true, | ||
moduleNameMapper: { | ||
"^(\\.{1,2}/.*)\\.js$": "$1", | ||
}, | ||
extensionsToTreatAsEsm: [".ts"], | ||
collectCoverageFrom: ["src/**/*.ts"], | ||
coverageReporters: ["html", "lcov", "text"], | ||
testPathIgnorePatterns: [], | ||
coveragePathIgnorePatterns: [], | ||
}; |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.