forked from mathesar-foundation/mathesar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
80 lines (56 loc) · 2.32 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
FROM python:3.9-buster
ARG PYTHON_REQUIREMENTS=requirements.txt
ENV PYTHONUNBUFFERED=1
ENV DOCKERIZE_VERSION v0.6.1
ENV NODE_MAJOR 18
ARG BUILD_PG_MAJOR=15
ENV PG_MAJOR=$BUILD_PG_MAJOR
RUN set -eux;
#---------- 1. INSTALL SYSTEM DEPENDENCIES -----------------------------------#
RUN mkdir -p /etc/apt/keyrings;
# Add Postgres source
RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - ; \
echo "deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main" > /etc/apt/sources.list.d/pgdg.list;
# Add Node.js source
RUN 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;
# Install common dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
sudo \
ca-certificates \
curl \
gnupg \
gettext \
nodejs \
locales \
&& rm -rf /var/lib/apt/lists/*
# Define Locale
RUN localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LANG en_US.utf8
# Install Postgres
RUN apt-get update && \
apt-get install -y --no-install-recommends \
postgresql-$PG_MAJOR postgresql-client-$PG_MAJOR postgresql-contrib-$PG_MAJOR \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
#---------- 2. CONFIGURE SYSTEM DEPENDENCIES ---------------------------------#
# Postgres
ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
ENV PGDATA /var/lib/postgresql/mathesar
VOLUME /etc/postgresql/
VOLUME /var/lib/postgresql/
# We set the default STOPSIGNAL to SIGINT, which corresponds to what PostgreSQL
# calls "Fast Shutdown mode" wherein new connections are disallowed and any
# in-progress transactions are aborted, allowing PostgreSQL to stop cleanly and
# flush tables to disk, which is the best compromise available to avoid data
# corruption.
STOPSIGNAL SIGINT
EXPOSE 5432
#---------- 3. SETUP MATHESAR ------------------------------------------------#
WORKDIR /code/
COPY requirements* ./
RUN pip install --no-cache-dir -r ${PYTHON_REQUIREMENTS} --force-reinstall sqlalchemy-filters
COPY . .
RUN cd mathesar_ui && npm ci && npm run build
EXPOSE 8000 3000 6006
ENTRYPOINT ["./run.sh"]