-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (28 loc) · 872 Bytes
/
Dockerfile
File metadata and controls
39 lines (28 loc) · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
FROM postgres:13
# Install required packages
RUN apt-get update && apt-get install -y \
build-essential \
postgresql-server-dev-13
# Create a directory for the source files with the necessary permissions
RUN mkdir -p /usr/local/src/udf
# Copy UDF source, control, and makefile into the container
COPY string_udf.c /usr/local/src/udf/
COPY Makefile /usr/local/src/udf/
COPY string_udf--1.0.sql /usr/local/src/udf/
COPY string_udf.control /usr/local/src/udf/
# Change ownership to the postgres user
RUN chown -R postgres:postgres /usr/local/src/udf
# Switch to user postgres for compiling
USER postgres
# Set working directory
WORKDIR /usr/local/src/udf
# Build the UDF
RUN make
# Switch back to root for installation
USER root
# Install the UDF
RUN make install
# Switch back to postgres user
USER postgres
# Start the PostgreSQL server
CMD ["postgres"]