-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
60 lines (46 loc) · 1.4 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
56
57
58
59
60
# syntax=docker/dockerfile:1
ARG PYTHON_VERSION=3.12.5
FROM 310118226683.dkr.ecr.eu-west-1.amazonaws.com/python:${PYTHON_VERSION} as base
# Copy the project files
COPY . .
RUN apt-get update && apt-get install -y nodejs npm
# Initialize git repository
RUN git init && \
git add -A && \
git commit -m "Initial commit"
# Manually clone submodules
RUN mkdir -p lib/forge-std && \
git clone https://github.com/foundry-rs/forge-std.git lib/forge-std
# Run Forge commands
RUN forge install --no-commit
RUN forge update
RUN forge build
# Create a non-privileged user
ARG UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
appuser
RUN mkdir -p /app/logs /app/state
# Install Python dependencies
RUN --mount=type=cache,target=/root/.cache/pip \
--mount=type=bind,source=requirements.txt,target=requirements.txt \
python -m pip install -r requirements.txt
# Install NPM dependencies
WORKDIR /redstone_script
COPY redstone_script/package.json redstone_script/package-lock.json* ./
RUN npm ci
WORKDIR /
# Set correct permissions
RUN chown -R appuser:appuser /app && \
chmod -R 755 /app && \
chmod 777 /app/logs /app/state
USER appuser
EXPOSE 8080
# CMD ["python", "python/liquidation_bot.py"]
# Run the application
CMD ["gunicorn", "--bind", "0.0.0.0:8080", "application:application"]