-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile
48 lines (32 loc) · 1.24 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
FROM python:3.9.13-alpine3.16 AS compiler
ARG SCARB_VERSION
RUN apk add git musl-dev curl
# Install scarb
# doesn't work with /bin/sh and bash is not available by default
ARG SHELL=/bin/ash
RUN curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | $SHELL -s -- -v $SCARB_VERSION
ARG COMPILER_BINARY_URL
ARG CAIRO_COMPILER_ASSET_NAME
# Download cairo1 compiler
ADD $COMPILER_BINARY_URL /$CAIRO_COMPILER_ASSET_NAME
RUN tar -zxvf $CAIRO_COMPILER_ASSET_NAME
# Install cairo-lang
COPY requirements.txt .
RUN apk add gmp-dev g++ gcc
ARG CAIRO_VERSION
ARG OZ_VERSION
RUN pip wheel --no-cache-dir --no-deps\
--wheel-dir /wheels\
-r requirements.txt\
cairo-lang==$CAIRO_VERSION openzeppelin-cairo-contracts==$OZ_VERSION
# Final image
FROM python:3.9.13-alpine3.16
ARG SCARB_VERSION
RUN apk add --no-cache libgmpxx
COPY --from=compiler /wheels /wheels
# We copy to /usr/local/bin/target/release as expected by starknet-hardhat-plugin.
COPY --from=compiler /cairo/bin /usr/local/bin/target/release
COPY --from=compiler /cairo/corelib /usr/local/bin/target/corelib
COPY --from=compiler /root/.local/share/scarb-install/${SCARB_VERSION}/bin/scarb /usr/local/bin/scarb
RUN pip install --no-cache /wheels/*
RUN rm -rf /wheels