-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
55 lines (42 loc) · 1.67 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
FROM python:3.10-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install poetry
ENV POETRY_VERSION=1.7.1
ENV POETRY_HOME=/opt/poetry
ENV POETRY_VENV=/opt/poetry-venv
ENV POETRY_CACHE_DIR=/opt/.cache
# Install poetry separated from system python
RUN python3 -m venv $POETRY_VENV \
&& $POETRY_VENV/bin/pip install -U pip setuptools \
&& $POETRY_VENV/bin/pip install poetry==${POETRY_VERSION}
# Add `poetry` to PATH
ENV PATH="${PATH}:${POETRY_VENV}/bin"
# Set working directory
WORKDIR /app
# Create data directory and set permissions
RUN mkdir -p /app/data && chmod 777 /app/data
# Copy only requirements to cache them in docker layer
COPY pyproject.toml ./
# Project initialization
RUN poetry config virtualenvs.create false
# Copy the entire project, including config files and ABIs
COPY . .
# Install dependencies and the project itself with scripts
RUN poetry install --no-interaction --no-ansi --with scripts && \
poetry run pip install -e . && \
# Create symbolic links for the scripts
ln -s /app/loop_dune/collector.py /usr/local/bin/loop-collect && \
ln -s /app/loop_dune/dune_uploader.py /usr/local/bin/loop-upload && \
ln -s /app/loop_dune/dashboard.py /usr/local/bin/loop-dashboard && \
ln -s /app/loop_dune/sync.py /usr/local/bin/loop-sync
# Set environment variables
ENV PYTHONPATH=/app
# Verify ABI files are present
RUN ls -la /app/loop_dune/config/abis/eth/ && \
ls -la /app/loop_dune/config/abis/bnb/ && \
ls -la /app/loop_dune/config/abis/usd/
# Run the script
CMD ["poetry", "run", "python", "loop_dune/scripts/collect_and_upload.py", "--cron", "0 0 * * *"]