Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Based on https://github.com/matsuu/docker-pgbadger

FROM alpine
RUN \
apk update && \
apk upgrade && \
apk add perl && \
apk add --virtual .build curl make

ADD . /workdir
RUN \
( \
cd /workdir && \
perl Makefile.PL && \
make install \
) && \
apk del --purge .build && \
rm -rf /workdir/*

WORKDIR /workdir
ENTRYPOINT ["/usr/local/bin/pgbadger"]
CMD ["--help"]
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,9 @@ For example, to install everything just like Debian does, proceed as follows:

By default INSTALLDIRS is set to site.

### DOCKER IMAGE
You can build a docker image of pgbadger following the instructions in [README_Docker.md](README_docker.md)

### POSTGRESQL CONFIGURATION

You must enable and set some configuration directives in your postgresql.conf
Expand Down
28 changes: 28 additions & 0 deletions README_docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Dockerfile
## Build docker image
```
$ docker build -t pgbadger:latest .
```

To be able to rebuild existing image when source code changes, run
```
$ docker rmi pgbadger
```
and then rebuild the image


## Use
```
$ docker run -i --rm -v $(pwd):/workdir pgbadger:latest -f stderr -p "%t:%r:%u@%d:[%p]:" postgresql.log.2019-11-08-10 --outfile report.html
```

Or parse multiple files at once with 4 threads:
```
$ cat files_to_parse.txt
postgresql.log.2019-11-08-08
postgresql.log.2019-11-08-09
postgresql.log.2019-11-08-10
postgresql.log.2019-11-08-11

$ docker run -i --rm -v $(pwd):/workdir pgbadger:latest -j 4 -f stderr -p "%t:%r:%u@%d:[%p]:" -L files_to_parse.txt --outfile report.html
```