Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions infra/price-pusher/offchain/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM python:3.12-slim AS base

ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100

ENV PATH="/root/.local/bin:${PATH}"

FROM base as builder

RUN apt-get update &&
apt-get install --no-install-recommends -y \
gcc \
libgmp3-dev \
pipx

RUN pipx install uv
COPY pragma-sdk/ /opt/pragma-sdk/
COPY pragma-utils/ /opt/pragma-utils/
COPY price-pusher/ /opt/price-pusher/
WORKDIR /opt/price-pusher
RUN uv sync --all-extras

FROM base as final
COPY --from=builder /opt /opt
COPY infra/price-pusher/config/ /opt/price-pusher/config/
WORKDIR /opt/price-pusher
ENTRYPOINT /opt/price-pusher/.venv/bin/python3.12 price_pusher/main.py -c ${CONFIG_PATH} -t ${TARGET} -n ${NETWORK} -p ${PRIVATE_KEY} --publisher-name ${PUBLISHER_NAME} --publisher-address ${PUBLISHER_ADDRESS} --api-key ${API_KEY} --api-base-url ${API_BASE_URL}
30 changes: 30 additions & 0 deletions infra/price-pusher/offchain/buildspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: 0.2
phases:
pre_build:
commands:
- echo Logging in to Amazon ECR...
- aws --version
- aws ecr get-login-password --region $ECR_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$ECR_REGION.amazonaws.com
- REPOSITORY_URI=$AWS_ACCOUNT_ID.dkr.ecr.$ECR_REGION.amazonaws.com/$ECR_REPOSITORY_NAME
- COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
- IMAGE_TAG=${COMMIT_HASH:=latest}
build:
commands:
- echo Build started on `date`
- echo Building the Docker image...
- ls -ltr
- docker build -f infra/price-pusher/offchain/Dockerfile -t $REPOSITORY_URI:latest .
- docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG
post_build:
commands:
- echo Build completed on `date`
- echo Pushing the Docker images...
- docker push $REPOSITORY_URI:latest
- docker push $REPOSITORY_URI:$IMAGE_TAG
- echo Writing image definitions file...
- printf '[{"name":"%s","imageUri":"%s"}]' $ECS_CONTAINER_NAME $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json
artifacts:
files:
- imagedefinitions.json
- infra/price-pusher/offchain/config.yml
discard-paths: yes
15 changes: 15 additions & 0 deletions infra/price-pusher/offchain/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
path: "/"
container_port: 8080
health_check_path: "/"
container_environment:
- region: "eu-west-3"
- prefix: "/conf/{{ SERVICE_NAME }}/{{ RUN_ENV }}"
- keys:
- CONFIG_PATH
- TARGET
- NETWORK
- PRIVATE_KEY
- PUBLISHER_NAME
- PUBLISHER_ADDRESS
- API_KEY
- API_BASE_URL
Loading