|
1 | | -FROM node:16 AS builder |
| 1 | +FROM node:22 AS frontend-builder |
2 | 2 |
|
3 | 3 | COPY frontend /frontend |
4 | 4 | WORKDIR /frontend |
5 | 5 | RUN yarn install --frozen-lockfile && yarn build |
6 | 6 |
|
7 | | -# COPY example /example |
8 | | -# WORKDIR /example |
9 | | -# RUN yarn install --frozen-lockfile && yarn build |
10 | | - |
11 | | -COPY wizard /wizard |
12 | | -WORKDIR /wizard |
13 | | -RUN yarn install --frozen-lockfile && yarn build |
14 | 7 |
|
| 8 | +FROM python:3.11-alpine AS backend-builder |
15 | 9 |
|
16 | | -FROM nginx:1.25 |
17 | | -COPY backend/requirements.txt requirements.txt |
| 10 | +ENV PYTHONUNBUFFERED=1 \ |
| 11 | + PYTHONDONTWRITEBYTECODE=1 \ |
| 12 | + PIP_NO_CACHE_DIR=1 \ |
| 13 | + PIP_DISABLE_PIP_VERSION_CHECK=1 \ |
| 14 | + POETRY_VERSION=1.8.3 \ |
| 15 | + POETRY_HOME="/opt/poetry" \ |
| 16 | + POETRY_NO_INTERACTION=1 \ |
| 17 | + POETRY_VIRTUALENVS_IN_PROJECT=true \ |
| 18 | + POETRY_VIRTUALENVS_CREATE=true |
18 | 19 |
|
19 | | -RUN apt-get update && apt-get install -y \ |
20 | | - python3 \ |
21 | | - python3-pip \ |
| 20 | +RUN apk add --no-cache \ |
22 | 21 | gcc \ |
23 | | - libssl-dev \ |
24 | | - python3-dev \ |
| 22 | + musl-dev \ |
25 | 23 | libffi-dev \ |
26 | | - && rm -rf /var/lib/apt/lists/* |
27 | | -RUN pip3 install --break-system-packages uwsgi==2.0.26 |
28 | | -RUN pip3 install --break-system-packages --upgrade pip |
29 | | -# Install stellar-sdk first to get compatible yarl version |
30 | | -RUN pip3 install --break-system-packages stellar-sdk==9.1.0 |
31 | | -# Increase timeout and retries for slow network connections |
32 | | -RUN pip3 install --break-system-packages \ |
33 | | - --default-timeout=100 \ |
34 | | - --retries=5 \ |
35 | | - -r requirements.txt --ignore-installed |
36 | | - |
37 | | -COPY --from=builder /frontend/dist /var/www/html/frontend |
38 | | -# COPY --from=builder /example/dist /var/www/html/example |
39 | | -COPY --from=builder /wizard/dist /var/www/html/wizard |
40 | | - |
41 | | -COPY backend/ /usr/share/nginx/backend |
| 24 | + openssl-dev \ |
| 25 | + python3-dev \ |
| 26 | + linux-headers \ |
| 27 | + curl \ |
| 28 | + make |
| 29 | + |
| 30 | +RUN curl -sSL https://install.python-poetry.org | python3 - |
| 31 | + |
| 32 | +ENV PATH="$POETRY_HOME/bin:$PATH" |
| 33 | + |
| 34 | +WORKDIR /app |
| 35 | +COPY backend/pyproject.toml backend/poetry.lock* ./ |
| 36 | + |
| 37 | +RUN poetry install --only main --no-root --no-directory |
| 38 | + |
| 39 | +COPY backend/ ./ |
| 40 | + |
| 41 | +RUN poetry install --only main |
| 42 | + |
| 43 | + |
| 44 | +FROM nginx:1.27-alpine AS runtime |
| 45 | + |
| 46 | +RUN apk add --no-cache \ |
| 47 | + libffi \ |
| 48 | + openssl \ |
| 49 | + libgcc \ |
| 50 | + libstdc++ \ |
| 51 | + sqlite-libs |
| 52 | + |
| 53 | +ENV PYTHONUNBUFFERED=1 \ |
| 54 | + PYTHONDONTWRITEBYTECODE=1 \ |
| 55 | + VIRTUAL_ENV=/app/.venv \ |
| 56 | + PATH="/usr/local/bin:/app/.venv/bin:$PATH" \ |
| 57 | + LD_LIBRARY_PATH="/usr/local/lib" |
| 58 | + |
| 59 | +COPY --from=backend-builder /usr/local/bin/python3.11 /usr/local/bin/python3.11 |
| 60 | +COPY --from=backend-builder /usr/local/bin/python3 /usr/local/bin/python3 |
| 61 | +COPY --from=backend-builder /usr/local/lib/python3.11 /usr/local/lib/python3.11 |
| 62 | +COPY --from=backend-builder /usr/local/lib/libpython3.11.so.1.0 /usr/local/lib/libpython3.11.so.1.0 |
| 63 | +COPY --from=backend-builder /usr/local/lib/libpython3.so /usr/local/lib/libpython3.so |
| 64 | + |
| 65 | +COPY --from=backend-builder /app/.venv /app/.venv |
| 66 | +COPY --from=backend-builder /app /usr/share/nginx/backend |
| 67 | +COPY --from=frontend-builder /frontend/dist /var/www/html/frontend |
42 | 68 |
|
43 | 69 | COPY nginx.conf /etc/nginx/conf.d/default.conf |
44 | 70 | COPY services.sh /services.sh |
45 | 71 | RUN chmod +x /services.sh |
| 72 | + |
46 | 73 | WORKDIR /usr/share/nginx/backend/ |
47 | 74 |
|
| 75 | +EXPOSE 5000 |
| 76 | + |
48 | 77 | CMD ["/services.sh"] |
0 commit comments