forked from mage-ai/mage-ai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
90 lines (78 loc) · 3.88 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
78
79
80
81
82
83
84
85
86
87
88
89
90
FROM python:3.10-bookworm AS builder
COPY . /home/mage_ai
RUN cd /home/mage_ai && python setup.py sdist bdist_wheel
RUN cd /home/mage_ai/mage_integrations && python setup.py sdist bdist_wheel
FROM python:3.10-bookworm
LABEL description="Deploy Mage on ECS"
USER root
ARG UID=7554
ARG GID=7554
ARG UNAME=mageai
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Mage
COPY ./mage_ai/server/constants.py /tmp/constants.py
## Startup Script
COPY --chmod=+x ./scripts/install_other_dependencies.py ./scripts/run_app.sh /mageai/app/
COPY requirements.txt /tmp/requirements.txt
COPY --from=builder /home/mage_ai/dist /tmp/dist
COPY --from=builder /home/mage_ai/mage_integrations/dist /tmp/dist
## System Packages
RUN \
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list && \
apt-get -y update && \
ACCEPT_EULA=Y apt-get -y install --no-install-recommends \
# NFS dependencies
nfs-common \
# odbc dependencies
msodbcsql18\
unixodbc-dev \
# R
r-base && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
## libssl \
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_amd64.deb && \
dpkg -i libssl1.1_1.1.0g-2ubuntu4_amd64.deb && rm libssl1.1_1.1.0g-2ubuntu4_amd64.deb && \
## R Packages
R -e "install.packages('pacman', repos='http://cran.us.r-project.org')" && \
R -e "install.packages('renv', repos='http://cran.us.r-project.org')" && \
## Python Packages
pip3 install --no-cache-dir sparkmagic && \
mkdir ~/.sparkmagic && \
curl https://raw.githubusercontent.com/jupyter-incubator/sparkmagic/master/sparkmagic/example_config.json > ~/.sparkmagic/config.json && \
sed -i 's/localhost:8998/host.docker.internal:9999/g' ~/.sparkmagic/config.json && \
jupyter-kernelspec install --user "$(pip3 show sparkmagic | grep Location | cut -d' ' -f2)/sparkmagic/kernels/pysparkkernel" && \
# Mage integrations and other related packages
pip3 install --no-cache-dir "git+https://github.com/wbond/oscrypto.git@d5f3437ed24257895ae1edd9e503cfb352e635a8" && \
pip3 install --no-cache-dir "git+https://github.com/mage-ai/singer-python.git#egg=singer-python" && \
pip3 install --no-cache-dir "git+https://github.com/mage-ai/google-ads-python.git#egg=google-ads" && \
pip3 install --no-cache-dir "git+https://github.com/mage-ai/dbt-mysql.git#egg=dbt-mysql" && \
pip3 install --no-cache-dir "git+https://github.com/mage-ai/dbt-synapse.git#egg=dbt-synapse" && \
pip3 install --no-cache-dir "git+https://github.com/mage-ai/mage-ai.git#egg=mage-integrations&subdirectory=mage_integrations" && \
pip3 install --no-cache-dir "git+https://github.com/mage-ai/mage-ai.git#egg=mage-ai[extra]" && \
pip3 install --no-cache-dir "git+https://github.com/dremio-hub/arrow-flight-client-examples.git#egg=dremio-flight&subdirectory=python/dremio-flight" && \
# Requirements
pip3 install --no-cache-dir -r /tmp/requirements.txt && \
rm /tmp/requirements.txt && \
# Install Mage
tag=$(tail -n 1 /tmp/constants.py) && \
VERSION=$(echo "$tag" | tr -d "'") && \
pip3 install "mage-ai[azure]" "mage-ai[clickhouse]" "mage-ai[dbt]" "mage-ai[google-cloud-storage]" "mage-ai[mysql]" "mage-ai[postgres]" "mage-ai[redshift]" "mage-ai[s3]" "mage-ai[snowflake]" "mage-ai[spark]" "mage-ai[streaming]" && \
pip3 install --no-cache-dir /tmp/dist/mage-ai-$VERSION.tar.gz && \
pip3 install --no-cache-dir /tmp/dist/mage-integrations-0.0.0.tar.gz && \
rm /tmp/constants.py && \
# Setup user
groupadd -g $GID -o $UNAME && \
useradd -m -u $UID -g $GID -o -d /mageai $UNAME && \
chown -R ${UNAME}:${UNAME} /mageai
ENV MAGE_DATA_DIR="/mageai/mage_data"
ENV PYTHONPATH="${PYTHONPATH}:/mageai"
WORKDIR /mageai
EXPOSE 6789
EXPOSE 7789
USER $UID
WORKDIR /mageai
CMD ["/bin/sh", "-c", "/mageai/app/run_app.sh"]