obmp-docker/postgres/Dockerfile

50 lines
1.5 KiB
Docker
Raw Normal View History

# Postgres Container
#
2022-02-22 14:30:05 -08:00
# Copyright (c) 2021-2022 Cisco Systems, Inc. and others. All rights reserved.
#
# Build:
2022-06-08 11:53:55 -07:00
# DOCKER_BUILDKIT=1 docker build --platform linux/amd64 \
# --build-arg VERSION=2.2.1 \
2022-06-08 11:53:55 -07:00
# --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
2022-06-08 11:53:55 -07:00
ARG VERSION=0.0.0
2022-06-08 11:53:55 -07:00
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"]
2022-06-08 11:53:55 -07:00
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
2022-06-08 11:53:55 -07:00
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}
2022-06-08 11:53:55 -07:00
USER postgres