forked from rotki/rotki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
77 lines (58 loc) · 2.54 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# build stage
FROM --platform=$BUILDPLATFORM node:18-buster as frontend-build-stage
ARG BUILDARCH
WORKDIR /app
COPY frontend/ .
RUN if [ "$BUILDARCH" != "amd64" ]; then apt-get update && apt-get install -y build-essential python3 --no-install-recommends; fi
RUN npm install -g pnpm@8 && pnpm install --no-optional --frozen-lockfile
RUN pnpm run docker:build
FROM python:3.9-buster as backend-build-stage
ARG TARGETARCH
ARG ROTKI_VERSION
ENV PACKAGE_FALLBACK_VERSION=$ROTKI_VERSION
ARG PYINSTALLER_VERSION=v5.7.0
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
WORKDIR /app
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
COPY colibri/ ./colibri
RUN cargo build --target-dir /tmp/dist/colibri --manifest-path ./colibri/Cargo.toml --release
RUN python3 -m pip install --upgrade pip setuptools wheel
COPY ./requirements.txt /app/requirements.txt
WORKDIR /app
RUN pip install -r requirements.txt
COPY . /app
RUN if [ "$TARGETARCH" != "amd64" ]; then \
git clone https://github.com/pyinstaller/pyinstaller.git && \
cd pyinstaller && git checkout ${PYINSTALLER_VERSION} && \
cd bootloader && ./waf all && cd .. && \
pip install .; \
else \
pip install pyinstaller==${PYINSTALLER_VERSION}; \
fi
RUN sed "s/fallback_version.*/fallback_version = \"$PACKAGE_FALLBACK_VERSION\"/" -i pyproject.toml && pip install . && \
python -c "import sys;from rotkehlchen.db.misc import detect_sqlcipher_version; version = detect_sqlcipher_version();sys.exit(0) if version == 4 else sys.exit(1)" && \
PYTHONOPTIMIZE=2 pyinstaller --noconfirm --clean --distpath /tmp/dist rotkehlchen.spec
FROM nginx:1.21 as runtime
LABEL maintainer="Rotki Solutions GmbH <[email protected]>"
ARG REVISION
ARG ROTKI_VERSION
ENV REVISION=$REVISION
ENV ROTKI_VERSION=$ROTKI_VERSION
RUN apt-get update && \
apt-get install -y procps python3 --no-install-recommends && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
COPY --from=backend-build-stage /tmp/dist /opt/rotki
COPY --from=frontend-build-stage /app/app/dist /opt/rotki/frontend
RUN APP=$(find "/opt/rotki" -name "rotki-core-*-linux" | head -n 1) && \
echo "${APP}" && \
ln -s "${APP}" /usr/sbin/rotki && \
ln -s /opt/rotki/colibri/release/colibri /usr/sbin/colibri
VOLUME ["/data", "/logs", "/config"]
EXPOSE 80
COPY ./packaging/docker/nginx.conf /etc/nginx/conf.d/default.conf
COPY ./packaging/docker/entrypoint.py /opt/rotki
CMD ["/opt/rotki/entrypoint.py"]
HEALTHCHECK CMD curl --fail http://localhost/api/1/ping || exit 1