forked from RunOnFlux/chainweb-data-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
79 lines (64 loc) · 2.63 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
# syntax=docker/dockerfile:experimental
# Run as
#
# --ulimit nofile=64000:64000
# BUILD PARAMTERS
ARG UBUNTUVER=20.04
FROM ubuntu:${UBUNTUVER}
RUN DEBIAN_FRONTEND=noninteractive apt-get update -y \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y wget curl gnupg git cron lsof jq supervisor \
&& wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& echo "deb http://apt.postgresql.org/pub/repos/apt focal-pgdg main" > /etc/apt/sources.list.d/pgdg.list
RUN set -eux; \
groupadd -r postgres --gid=999; \
useradd -r -g postgres --uid=999 --home-dir=/var/lib/postgresql --shell=/bin/bash postgres; \
mkdir -p /var/lib/postgresql; \
chown -R postgres:postgres /var/lib/postgresql
ENV PG_VERSION=13 \
PG_USER=postgres \
PG_LOGDIR=/var/log/postgresql \
PGDATA=/var/lib/postgresql/data \
FONTCONFIG_FILE=/etc/fonts/fonts.conf \
LANG=en_US.UTF-8 \
LC_ALL=en_US.UTF-8 \
LC_CTYPE=en_US.UTF-8 \
LOCALE_ARCHIVE=/usr/lib/locale/locale-archive \
NIX_PATH=nixpkgs=/root/.nix-defexpr/channels/nixpkgs:/root/.nix-defexpr/channels \
NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt \
PATH=/root/.nix-profile/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV CHAINWEB_NODE_HOST=172.15.0.1 \
CHAINWEB_NODE_SERVICE_PORT=31351 \
CHAINWEB_NODE_P2P_PORT=31350 \
NETWORK_ID=mainnet01
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y acl sudo locales \
postgresql-${PG_VERSION} postgresql-client-${PG_VERSION} postgresql-contrib-${PG_VERSION} \
&& update-locale LANG=C.UTF-8 LC_MESSAGES=POSIX \
&& locale-gen en_US.UTF-8 \
&& DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales \
&& rm -rf /var/lib/apt/lists/*
RUN rm /etc/postgresql/13/main/pg_hba.conf
RUN rm /etc/postgresql/13/main/postgresql.conf
RUN mkdir -p /var/log/supervisor
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY chainweb-data.sh /chainweb-data.sh
COPY postgres_init.sh /postgres_init.sh
COPY backfill.sh /backfill.sh
COPY gaps.sh /gaps.sh
COPY postgres.sh /postgres.sh
COPY nix.conf /tmp/nix.conf
COPY pg_hba.conf /etc/postgresql/13/main/pg_hba.conf
COPY check-health.sh /check-health.sh
COPY postgresql.conf /etc/postgresql/13/main/postgresql.conf
VOLUME /var/lib/postgresql/data
RUN chmod 755 /chainweb-data.sh
RUN chmod 755 /backfill.sh
RUN chmod 755 /gaps.sh
RUN chmod 755 /check-health.sh
RUN chmod 755 /postgres_init.sh
RUN chmod 755 /postgres.sh
EXPOSE 8888/tcp
EXPOSE 5432/tcp
HEALTHCHECK --start-period=10m --interval=1m --retries=5 --timeout=20s CMD /check-health.sh
WORKDIR "/var/lib/postgresql/data"
ENTRYPOINT ["/usr/bin/supervisord"]