diff --git a/.github/workflows/push-rust-services.yaml b/.github/workflows/push-rust-services.yaml index 6962b03d..2df22f1a 100644 --- a/.github/workflows/push-rust-services.yaml +++ b/.github/workflows/push-rust-services.yaml @@ -38,14 +38,27 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker - id: meta + id: meta_server uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - name: Build and push Docker image + - name: Extract metadata (tags, labels) for Docker + id: meta_monitor + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-monitor + - name: Build and push server docker image + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + with: + context: . + push: true + tags: ${{ steps.meta_server.outputs.tags }} + labels: ${{ steps.meta_server.outputs.labels }} + - name: Build and push vault monitor docker image uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 with: context: . + file: ./per_sdk/Dockerfile push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + tags: ${{ steps.meta_monitor.outputs.tags }} + labels: ${{ steps.meta_monitor.outputs.labels }} diff --git a/per_sdk/Dockerfile b/per_sdk/Dockerfile new file mode 100644 index 00000000..9e2be970 --- /dev/null +++ b/per_sdk/Dockerfile @@ -0,0 +1,62 @@ +git ARG RUST_VERSION=1.66.1 +ARG PYTHON_VERSION=3.11 +ARG POETRY_VERSION=1.6.1 + +FROM node:21-alpine3.18 AS npm_build + +WORKDIR /src +COPY per_multicall per_multicall +WORKDIR /src/per_multicall +RUN npm install + + +FROM rust:${RUST_VERSION} AS contract_build +# Set default toolchain +RUN rustup default nightly-2023-07-23 + +# Install dependencies +RUN curl -L https://foundry.paradigm.xyz | bash +ENV PATH="${PATH}:/root/.foundry/bin/" +RUN foundryup + +# Add solidity dependencies +WORKDIR /src +COPY per_multicall per_multicall +COPY --from=npm_build /src/per_multicall/node_modules/ /src/per_multicall/node_modules/ +WORKDIR /src/per_multicall +RUN forge install foundry-rs/forge-std --no-git --no-commit +RUN forge install OpenZeppelin/openzeppelin-contracts --no-git --no-commit +RUN forge build --via-ir + + +FROM python:$PYTHON_VERSION + + +ARG APP_NAME +ARG APP_PATH +ARG POETRY_VERSION + +ENV \ + PYTHONDONTWRITEBYTECODE=1 \ + PYTHONUNBUFFERED=1 \ + PYTHONFAULTHANDLER=1 +ENV \ + POETRY_VERSION=$POETRY_VERSION \ + POETRY_HOME="/opt/poetry" \ + POETRY_VIRTUALENVS_IN_PROJECT=true \ + POETRY_NO_INTERACTION=1 + +# Install Poetry - respects $POETRY_VERSION & $POETRY_HOME +RUN curl -sSL https://install.python-poetry.org | python +ENV PATH="$POETRY_HOME/bin:$PATH" + +# Copy only requirements to cache them in docker layer +WORKDIR /src +COPY per_sdk/poetry.lock per_sdk/pyproject.toml /src/per_sdk/ +COPY --from=contract_build /src/per_multicall/out/ /src/per_multicall/out/ + +# Project initialization: +RUN poetry -C per_sdk install --no-interaction --no-ansi + +# Creating folders, and files for a project: +COPY per_sdk/ /src/per_sdk