Open olimsaidov opened 7 years ago
Hey, This works for me. Added include to types.h:
FROM postgres:12-alpine as builder
RUN apk update && apk add git make gcc linux-headers libc-dev libxml2-dev alpine-sdk musl-dev
RUN git clone https://github.com/omniti-labs/pg_amqp.git workdir
ARG AMQP_H=src/librabbitmq/amqp.h
RUN cd workdir \
&& head -n 2 ${AMQP_H} > ${AMQP_H}.temp \
&& echo "#include <sys/types.h>" >> ${AMQP_H}.temp \
&& cat ${AMQP_H} | sed -e '1,3d' >> ${AMQP_H}.temp \
&& mv ${AMQP_H}.temp ${AMQP_H}
RUN cd workdir && make && make install
FROM postgres:12-alpine
COPY --from=builder /usr/local/lib/postgresql/pg_amqp.so /usr/local/lib/postgresql/pg_amqp.so
COPY --from=builder /usr/local/share/postgresql/extension /usr/local/share/postgresql/extension
COPY --from=builder /usr/local/share/doc/postgresql/extension /usr/local/share/doc/postgresql/extension
RUN chmod 755 /usr/local/lib/postgresql/pg_amqp.so \
&& chmod 644 /usr/local/share/postgresql/extension/amqp.control \
&& chmod 644 /usr/local/share/postgresql/extension/amqp--0.3.0--0.4.0.sql \
&& chmod 644 /usr/local/share/postgresql/extension/amqp--0.4.0--0.4.1.sql \
&& chmod 644 /usr/local/share/postgresql/extension/amqp--0.4.2.sql \
&& chmod 777 /usr/local/share/postgresql/extension/
I know that 777
is not recommended but it was for my local testing.
Hello, having the same issue and same error. @inbarbarkai even tried to run your dockerfile still the same error and terminate docker execution.
@sohrabq Here is a updated docker with the latest alpine
version.
# Docker file for postgres with pg_amqp extension installed and configured to use RabbitMQ
FROM postgres:alpine
RUN apk update && apk add git make gcc linux-headers libc-dev libxml2-dev alpine-sdk musl-dev postgresql-dev rabbitmq-c-dev
RUN git clone https://github.com/omniti-labs/pg_amqp.git workdir
ARG AMQP_H=src/librabbitmq/amqp.h
RUN cd workdir \
&& head -n 2 ${AMQP_H} > ${AMQP_H}.temp \
&& echo "#include <sys/types.h>" >> ${AMQP_H}.temp \
&& cat ${AMQP_H} | sed -e '1,3d' >> ${AMQP_H}.temp \
&& mv ${AMQP_H}.temp ${AMQP_H}
RUN cd workdir && make && make install
How can I build this repo in docker official alpine based postgres image. I am getting compile error:
Dockerfile content: