forked from skyportal/skyportal
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
78 lines (68 loc) · 3.1 KB
/
Copy pathDockerfile
File metadata and controls
78 lines (68 loc) · 3.1 KB
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
FROM debian:bookworm-slim
ARG DEBIAN_FRONTEND=noninteractive
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
ENV NODE_MAJOR=20
ENV NPM_CONFIG_LEGACY_PEER_DEPS=true
ENV PATH="/root/.cargo/bin:${PATH}"
ENV SNCOSMO_DATA_DIR=/skyportal/persistentdata/sncosmo
RUN apt-get update && \
apt-get install -y curl build-essential software-properties-common ca-certificates gnupg \
python3 python3-venv python3-dev libpq-dev supervisor libgdal-dev \
git postgresql-client vim nano screen htop rsync procps \
libcurl4-gnutls-dev libgnutls28-dev libkrb5-dev && \
mkdir -p /etc/apt/keyrings && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
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 && \
curl https://sh.rustup.rs -sSf | sh -s -- -y && \
apt-get update && \
apt-get install -y cargo nodejs nginx libnginx-mod-http-brotli-static libnginx-mod-http-brotli-filter && \
npm install -g npm@latest && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ARG SKYPORTAL_UID=1000
ARG SKYPORTAL_GID=1000
RUN groupadd -g $SKYPORTAL_GID skyportal && \
useradd -u $SKYPORTAL_UID -g $SKYPORTAL_GID --create-home --shell /bin/bash skyportal
ADD . /skyportal
WORKDIR /skyportal
RUN bash -c "\
cp docker.yaml config.yaml && \
python3 -m venv /skyportal_env && \
source /skyportal_env/bin/activate && \
pip install --upgrade pip wheel packaging 'setuptools<76.1.0' --no-cache && \
pip install -r baselayer/requirements.txt --no-cache && \
pip install -r requirements.txt --no-cache && \
make system_setup && \
\
./node_modules/.bin/rspack --mode=production && \
rm -rf node_modules && \
\
chown -R skyportal.skyportal /skyportal_env && \
chown -R skyportal.skyportal /skyportal && \
\
mkdir -p /skyportal/static/thumbnails && \
chown -R skyportal.skyportal /skyportal/static/thumbnails && \
\
mkdir -p /skyportal/persistentdata/analysis && \
chown -R skyportal.skyportal /skyportal/persistentdata/analysis && \
\
mkdir -p /skyportal/persistentdata/dustmap && \
chown -R skyportal.skyportal /skyportal/persistentdata/dustmap && \
\
mkdir -p /skyportal/persistentdata/phot_series && \
chown -R skyportal.skyportal /skyportal/persistentdata/phot_series && \
\
mkdir -p /skyportal/persistentdata/sncosmo && \
chown -R skyportal.skyportal /skyportal/persistentdata/sncosmo && \
# we remove the cache and temp files to reduce the image size
rm -rf /root/.cache/pip && rm -rf /tmp/* && \
# we remove some unused data from the gwemopt package to reduce the image size
rm -rf /skyportal_env/lib/python3.11/site-packages/gwemopt/data/tesselations/*.tess"
USER skyportal
# edit the exposed port to match the one in the
# docker.yaml, or just ignore it if you are
# specifying ports in docker-compose.yaml already
EXPOSE 5000
CMD bash -c "source /skyportal_env/bin/activate && \
(make log &) && \
make run_production"