From 5f45df5e4765df0d50bc5b63ff7b8395a86601bd Mon Sep 17 00:00:00 2001 From: Joshua Gilman Date: Thu, 7 Dec 2023 17:03:45 -0800 Subject: [PATCH] chore: adds vit-ss container and CI to build/publish it --- .github/workflows/ci.yml | 24 ++++++++++++++++++++++ Earthfile | 20 ++++++++++++++++++ vit-servicing-station-server/entrypoint.sh | 23 +++++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 vit-servicing-station-server/entrypoint.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..6aee4fb9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +name: CI + +on: + push: + +permissions: + id-token: write + contents: write + packages: write + +jobs: + ci: + uses: input-output-hk/catalyst-ci/.github/workflows/ci.yml@master + with: + aws_ecr_registry: 332405224602.dkr.ecr.eu-central-1.amazonaws.com + aws_role_arn: arn:aws:iam::332405224602:role/ci + aws_region: eu-central-1 + default_branch: catalyst-fund9-gold + secrets: + deployment_token: ${{ secrets.CI_BOT_TOKEN }} + dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }} + dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} + earthly_runner_address: ${{ secrets.EARTHLY_SATELLITE_ADDRESS }} + earthly_runner_secret: ${{ secrets.EARTHLY_RUNNER_SECRET }} \ No newline at end of file diff --git a/Earthfile b/Earthfile index 8872f12a..7b2940c6 100644 --- a/Earthfile +++ b/Earthfile @@ -71,3 +71,23 @@ build: SAVE ARTIFACT /src/target/release/vit-servicing-station-cli vit-servicing-station-cli SAVE ARTIFACT /src/target/release/vit-servicing-station-server vit-servicing-station-server + +publish: + FROM debian:stable-slim + WORKDIR /app + + ARG tag=latest + + RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + libssl-dev \ + libpq-dev \ + libsqlite3-dev + + COPY +build/vit-servicing-station-server . + COPY vit-servicing-station-server/entrypoint.sh . + RUN chmod +x entrypoint.sh + + ENTRYPOINT ["/app/entrypoint.sh"] + + SAVE IMAGE vit-servicing-station-server:${tag} \ No newline at end of file diff --git a/vit-servicing-station-server/entrypoint.sh b/vit-servicing-station-server/entrypoint.sh new file mode 100644 index 00000000..e9a57371 --- /dev/null +++ b/vit-servicing-station-server/entrypoint.sh @@ -0,0 +1,23 @@ +#!/usr/bin/bash + +echo ">>> Entering entrypoint script..." + +# Verify the config exists +if [[ ! -f "$CONFIG_PATH" ]]; then + echo "ERROR: configuration file does not exist at: $CONFIG_PATH" + echo ">>> Aborting..." + exit 1 +fi + +# Allow overriding vit-servicing-station-server binary +BIN_PATH=${BIN_PATH:=/app/vit-servicing-station-server} + +echo ">>> Using the following parameters:" +echo "Config file: $CONFIG_PATH" + +args+=() +args+=("--in-settings-file" "$CONFIG_PATH") +args+=("--service-version" "$VERSION") + +echo ">>> Running servicing station..." +exec "$BIN_PATH" "''${args[@]}"