-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
59 lines (49 loc) · 1.78 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
# copy everything into a single image
FROM ubuntu:22.04
# set up ENV. do this first because it won't ever change
ENV PATH /llama/venv/bin:$PATH
# Create llama user to avoid running container with root
RUN set -eux; \
\
mkdir /llama; \
adduser --home /llama --shell /sbin/nologin --gecos '' --no-create-home --disabled-password --uid 1000 llama; \
chown -R llama /llama
# install python dependencies
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
set -eux; \
\
apt-get update; \
apt-get install --no-install-recommends --yes build-essential ca-certificates git python3.10-venv python3.10-dev
# Run everything else as the "llama" user, not root
USER llama
# ENV HOME /llama # TODO: do we need this?
WORKDIR /llama
# create virtualenv
RUN --mount=type=cache,uid=1000,gid=1000,target=/llama/.cache \
\
python3 -m venv /llama/venv
# install python dependencies
RUN --mount=type=bind,source=requirements.txt,target=/llama/venv/requirements.txt \
--mount=type=cache,uid=1000,gid=1000,target=/llama/.cache \
\
pip install -r /llama/venv/requirements.txt
# install ape dependencies
RUN --mount=type=bind,source=ape-config.yaml,target=/llama/ape-config.yaml \
--mount=type=cache,uid=1000,gid=1000,target=/llama/.cache \
set -eux; \
\
ape plugins install . --yes; \
ape networks list; \
ape cache init --network ethereum; \
ape cache init --network polygon
# TODO: ape caches?
# install app
COPY . /llama/
RUN --mount=type=cache,uid=1000,gid=1000,target=/llama/.cache \
set -eux; \
\
mkdir -p /llama/.ape /llama/.build /llama/.tokenlists; \
ape compile
VOLUME [ "/llama/.ape", "/llama/.tokenlists" ]
ENTRYPOINT [ "silverback", "run", "entrypoint:app" ]