Dockerfile 874 B

1234567891011121314151617181920212223242526272829303132
  1. FROM alpine:3.7
  2. LABEL maintainer="robert.gauto@gmail.com"
  3. ENV USER=pg CONFIG_PATH=/etc/pgbouncer LOG_PATH=/var/log/pgbouncer PID_PATH=/var/run/pgbouncer
  4. RUN set -x \
  5. apk update && \
  6. apk upgrade && \
  7. apk add --no-cache --virtual \
  8. pgbouncer && \
  9. addgroup -S -g 1000 $USER && \
  10. adduser -S -H -D -h /home/$USER -s /bin/sh -u 1000 -G $USER $USER && \
  11. echo "$USER:$(dd if=/dev/urandom bs=24 count=1 status=none | base64)" | chpasswd && \
  12. mkdir -p $CONFIG_PATH && \
  13. mkdir -p $LOG_PATH && \
  14. mkdir -p $PID_PATH && \
  15. chmod -R 755 $LOG_PATH && \
  16. chmod -R 755 $PID_PATH && \
  17. chown -R $USER:$USER $LOG_PATH && \
  18. chown -R $USER:$USER $PID_PATH
  19. VOLUME ["$CONFIG_PATH", "$LOG_PATH"]
  20. COPY pgbouncer.ini "$CONFIG_PATH"
  21. COPY userlist.txt "$CONFIG_PATH"
  22. ADD entrypoint.sh ./
  23. EXPOSE 6432
  24. ENTRYPOINT ["./entrypoint.sh"]
  25. CMD ["pgbouncer"]