I have a multi-stage Docker container where I build jsonlog.
# Build stage
FROM postgres:11.5 AS build-env
ADD . /jsonlog
RUN apt-get update && apt-get install -y build-essential libkrb5-dev libssl-dev libpq-dev postgresql-server-dev-all
RUN cd /jsonlog && make install
# Used find to see where the output files are being installed
# RUN find / -name "*json*"
# Final stage
FROM postgres:11.5-alpine
COPY --from=build-env /usr/lib/postgresql/11/lib/bitcode/jsonlog/jsonlog.bc /usr/lib/postgresql/11/lib/bitcode/jsonlog/jsonlog.bc
COPY --from=build-env /usr/lib/postgresql/11/lib/bitcode/jsonlog.index.bc /usr/lib/postgresql/11/lib/bitcode/jsonlog.index.bc
COPY --from=build-env /usr/lib/postgresql/11/lib/jsonlog.so /usr/lib/postgresql/11/lib/jsonlog.so
The docker build seems to be okay. However, when I do a docker run, I get this error.
LOG: invalid value for parameter "log_destination": "jsonlog"
DETAIL: Unrecognized key word: "jsonlog".
FATAL: configuration file "/etc/postgresql/postgresql.conf" contains errors
The jsonlog code comes from this repo, https://github.com/michaelpq/pg_plugins/tree/master/jsonlog, which I cloned. I mount just the jsonlog directory into the build container.
The postgresql.conf is vanilla, except for these lines.
log_destination = 'jsonlog'
logging_collector = on
shared_preload_libraries = 'jsonlog'
The reason for doing a multi-stage container is to get rid of build dependencies and have a smaller container. I'd like to run postgres:11.5-alpine, but I also get errors with the postgres:11.5 image.
Update
I tried getting rid of the multi-stage and just keeping everything in 1 container like this.
FROM postgres:11.5
ADD . /jsonlog
RUN apt-get update && apt-get install -y build-essential libkrb5-dev libssl-dev libpq-dev postgresql-server-dev-all
RUN cd /jsonlog && make install
But that results in the exact Unrecognized key word: "jsonlog" error.
Also, also, I tried building in a Postgres 9.5 container and the same thing happens.