Sign inSign up

zurutech/node-postgres-dbmate

By zurutech

•Updated 2 months ago

To generate coverage report

Image
Databases & storage
0

636

zurutech/node-postgres-dbmate repository overview

# Use the official Node.js image with Alpine
FROM node:20.13.1-alpine

# Install dbmate
RUN npm install -g [email protected]

# Set environment variables for PostgreSQL version and data directory
ENV PGDATA=/var/lib/postgresql/data

# Install PostgreSQL and its dependencies
RUN apk update && apk add --no-cache postgresql16=16.3-r0 su-exec

# Create the PostgreSQL data directory and set permissions
RUN mkdir -p $PGDATA && chown -R postgres:postgres $PGDATA

# Create the directory for the Unix domain socket and set permissions
RUN mkdir -p /run/postgresql && chown -R postgres:postgres /run/postgresql

# Switch to the postgres user and initialize the database
USER postgres
RUN initdb --pgdata=$PGDATA

# Switch back to root to complete the setup
USER root

# Start PostgreSQL and keep the container running
CMD ["sh", "-c", "su-exec postgres pg_ctl -D $PGDATA -w start && tail -f /dev/null"]

Tag summary

Content type

Image

Digest

sha256:2b47ba717…

Size

186.2 MB

Last updated

2 months ago

docker pull zurutech/node-postgres-dbmate:node-22.15.0_postgres-v16_dbmate-v2.17.0