-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow and Dockerfile necessary to build the rust services
- Loading branch information
Showing
5 changed files
with
103 additions
and
86 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Build and Push Rust Services Image | ||
on: | ||
push: | ||
tags: | ||
- server-v* | ||
workflow_dispatch: | ||
inputs: | ||
dispatch_description: | ||
description: "Dispatch description" | ||
required: true | ||
type: string | ||
permissions: | ||
contents: read | ||
id-token: write | ||
jobs: | ||
server-image: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set image tag to version of the git tag | ||
if: ${{ startsWith(github.ref, 'refs/tags/server-v') }} | ||
run: | | ||
PREFIX="refs/tags/server-" | ||
VERSION="${GITHUB_REF:${#PREFIX}}" | ||
echo "IMAGE_TAG=${VERSION}" >> "${GITHUB_ENV}" | ||
- name: Set image tag to the git commit hash | ||
if: ${{ !startsWith(github.ref, 'refs/tags/server-v') }} | ||
run: | | ||
echo "IMAGE_TAG=${{ github.sha }}" >> "${GITHUB_ENV}" | ||
- uses: aws-actions/configure-aws-credentials@8a84b07f2009032ade05a88a28750d733cc30db1 | ||
with: | ||
role-to-assume: arn:aws:iam::192824654885:role/github-actions-ecr | ||
aws-region: eu-west-2 | ||
- uses: aws-actions/amazon-ecr-login@v1 | ||
id: ecr_login | ||
- run: | | ||
DOCKER_BUILDKIT=1 docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f Dockerfile . | ||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | ||
env: | ||
ECR_REGISTRY: ${{ steps.ecr_login.outputs.registry }} | ||
ECR_REPOSITORY: ${{ github.event.repository.name }} |
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,44 @@ | ||
ARG RUST_VERSION=1.66.1 | ||
|
||
# Get the solidity dependencies using npm | ||
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 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 | ||
|
||
# Build auction-server | ||
WORKDIR /src | ||
COPY auction-server auction-server | ||
WORKDIR /src/auction-server | ||
RUN --mount=type=cache,target=/root/.cargo/registry cargo build --release | ||
|
||
# Build vault-simulator | ||
WORKDIR /src | ||
COPY vault-simulator vault-simulator | ||
WORKDIR /src/vault-simulator | ||
RUN --mount=type=cache,target=/root/.cargo/registry cargo build --release | ||
|
||
|
||
FROM rust:${RUST_VERSION} | ||
# Copy artifacts from other images | ||
COPY --from=build /src/auction-server/target/release/auction-server /usr/local/bin/ | ||
COPY --from=build /src/vault-simulator/target/release/vault-simulator /usr/local/bin/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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