# Use the PostgresML image | |
FROM ghcr.io/postgresml/postgresml:2.7.12 | |
# Switch to root for initial setup | |
USER root | |
# Disable no-new-privileges security feature | |
RUN sed -i 's/no-new-privileges:true/no-new-privileges:false/' /etc/docker/daemon.json || true | |
# Create necessary directories | |
RUN mkdir -p /var/run/postgresql /var/lib/postgresql /home/postgresml/app | |
# Use the existing postgres user in the image | |
RUN chown -R postgres:postgres /var/run/postgresql /var/lib/postgresql /home/postgresml/app | |
# Set working directory | |
WORKDIR /home/postgresml/app | |
# Set environment variables | |
ENV HOME=/home/postgresml/app \ | |
PATH=/home/postgresml/.local/bin:$PATH | |
# Expose ports | |
EXPOSE 5432 8000 | |
# Switch to postgres user | |
USER postgres | |
# Default command | |
CMD ["bash", "-c", "psql -d postgresml"] |