-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
108 lines (88 loc) · 3.81 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
FROM --platform=linux/amd64 ubuntu:22.04 as stage-amd64
USER root
RUN apt-get update
RUN apt-get install -y unzip less vim curl && curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install
FROM --platform=linux/arm64 ubuntu:22.04 as stage-arm64
USER root
RUN apt-get update
RUN apt-get install -y unzip less vim curl && curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install
RUN apt-get update
# Declare TARGETARCH to make it available
ARG TARGETARCH
# Select final stage based on TARGETARCH ARG
FROM stage-${TARGETARCH} as final
ARG ARCHES_FOR_SCIENCE_HOST_DIR
ARG ARCHES_CORE_HOST_DIR
ARG ARCHES_TEMPLATING_HOST_DIR
## Setting default environment variables
ENV WEB_ROOT=/web_root
ENV APP_ROOT=${WEB_ROOT}/disco
# Root project folder
ENV ARCHES_ROOT=${WEB_ROOT}/arches
ENV AFS_ROOT=${WEB_ROOT}/arches-for-science
ENV TEMPLATING_ROOT=${WEB_ROOT}/arches-templating
ENV PYTHONUNBUFFERED=1
ENV NODE_MAJOR=18
RUN apt-get update && apt-get install -y make software-properties-common && apt-get install -y ca-certificates gnupg && mkdir -p /etc/apt/keyrings
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update
# Get the pre-built python wheels from the build environment
RUN mkdir ${WEB_ROOT}
# Install packages required to run Arches
# Note that the ubuntu/debian package for libgdal1-dev pulls in libgdal1i, which is built
# with everything enabled, and so, it has a huge amount of dependancies (everything that GDAL
# support, directly and indirectly pulling in mysql-common, odbc, jp2, perl! ... )
# a minimised build of GDAL could remove several hundred MB from the container layer.
RUN set -ex \
&& RUN_DEPS=" \
build-essential \
python3.10-dev \
mime-support \
libgdal-dev \
python3-venv \
postgresql-client-14 \
python3.10 \
python3.10-distutils \
python3.10-venv \
dos2unix \
git \
" \
&& apt-get install -y --no-install-recommends curl \
&& curl -sL https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& add-apt-repository "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -sc)-pgdg main" \
&& apt-get update -y \
&& apt-get install -y --no-install-recommends $RUN_DEPS
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python3 get-pip.py \
&& pip install setuptools \
&& apt-get install nodejs -y \
&& npm install -g yarn
WORKDIR ${WEB_ROOT}
RUN rm -rf /root/.cache/pip/*
# Install the Arches application
# FIXME: ADD from github repository instead?
COPY ${ARCHES_CORE_HOST_DIR} ${ARCHES_ROOT}
COPY ${ARCHES_FOR_SCIENCE_HOST_DIR} ${AFS_ROOT}
COPY ${ARCHES_TEMPLATING_HOST_DIR} ${TEMPLATING_ROOT}
WORKDIR ${AFS_ROOT}
RUN pip install -e .
RUN pip uninstall arches -y
WORKDIR ${TEMPLATING_ROOT}
RUN pip install -e .
# afs app installed _before_ arches core - otherwise afs dependencies will overwrite arches editable install.
WORKDIR ${ARCHES_ROOT}
RUN pip install -e . --user && pip install -r arches/install/requirements.txt && pip install -r arches/install/requirements_dev.txt
# TODO: These are required for non-dev installs, currently only depends on arches/afs
#COPY /disco/disco/install/requirements.txt requirements.txt
#RUN pip install -r requirements.txt
COPY /disco/docker/entrypoint.sh ${WEB_ROOT}/entrypoint.sh
RUN chmod -R 700 ${WEB_ROOT}/entrypoint.sh &&\
dos2unix ${WEB_ROOT}/entrypoint.sh
RUN mkdir /var/log/supervisor
RUN mkdir /var/log/celery
# Set default workdir
WORKDIR ${APP_ROOT}
# # Set entrypoint
ENTRYPOINT ["../entrypoint.sh"]
CMD ["run_arches"]
# Expose port 8000
EXPOSE 8000