-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathDockerfile
49 lines (39 loc) · 1.5 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
# Postgres Container
#
# Copyright (c) 2021-2022 Cisco Systems, Inc. and others. All rights reserved.
#
# Build:
# DOCKER_BUILDKIT=1 docker build --platform linux/amd64 \
# --build-arg VERSION=2.2.1 \
# --squash \
# -t openbmp/postgres:2.2.1 .
#
# Run:
# docker run --rm -it -p 5432:5432 \
# -e POSTGRES_PASSWORD=openbmp \
# -e POSTGRES_USER=openbmp \
# -e POSTGRES_DB=openbmp \
# openbmp/postgres:2.2.1
# -----------------------------------------------
# stage: Build
# -----------------------------------------------
# -----------------------------------------------
# stage: Final container
# -----------------------------------------------
FROM timescale/timescaledb-ha:pg14-ts2.8-latest
ARG VERSION=0.0.0
ENV PGDATA=/var/lib/postgresql/data
ENV PGDATA_TS=/var/lib/postgresql/ts/data
# Expected data locations for base tables and timeseries
#
VOLUME ["/var/lib/postgresql/data"]
VOLUME ["/var/lib/postgresql/ts"]
ADD --chmod=755 scripts/004_obmp_psql_cfg.sh /docker-entrypoint-initdb.d/004_obmp_psql_cfg.sh
ADD --chmod=755 scripts/005_obmp_init.sh /docker-entrypoint-initdb.d/005_obmp_init.sh
USER root
RUN rm -rf /usr/lib/postgresql/12 /usr/lib/postgresql/13 \
&& mkdir -p /var/lib/postgresql/data /var/lib/postgresql/ts/data \
&& chown -R postgres /var/lib/postgresql/data /var/lib/postgresql/ts/data \
&& mkdir -p /usr/local/openbmp \
&& touch /usr/local/openbmp/version-${VERSION}
USER postgres