Dockerfile 595 B

1234567891011121314151617181920
  1. FROM postgres:17.2
  2. ARG USER_ID
  3. ARG GROUP_ID
  4. RUN apt-get update && apt-get install -y sudo;
  5. RUN addgroup --gid ${GROUP_ID} postgres || \
  6. groupmod --gid ${GROUP_ID} postgres
  7. RUN adduser --gecos 'PostGres' --uid ${USER_ID} --gid ${GROUP_ID} --disabled-password postgres || \
  8. usermod --uid ${USER_ID} --gid ${GROUP_ID} postgres && passwd -d postgres
  9. RUN echo 'postgres ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
  10. RUN usermod -G root,sudo postgres
  11. RUN chown -R postgres:postgres /var/lib/postgresql \
  12. && chown -R postgres:postgres /var/run/postgresql
  13. USER postgres
  14. LABEL "name"="postgresX"