Skip to content

Commit

Permalink
Add docker stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Florents-Tselai committed Nov 15, 2024
1 parent 6c0a269 commit a8b5e2f
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/.git/
/dist/
/results/
/tmp_check/
regression.*
*.o
*.so
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
ARG PG_MAJOR=17
FROM postgres:$PG_MAJOR
ARG PG_MAJOR

COPY . /tmp/pgpdf

RUN apt-get update && \
apt-mark hold locales && \
apt-get install -y --no-install-recommends libpoppler-glib-dev pkg-config wget build-essential postgresql-server-dev-$PG_MAJOR && \
cd /tmp/pgpdf && \
make clean && \
make install && \
mkdir /usr/share/doc/pgpdf && \
cp LICENSE README.md /usr/share/doc/pgpdf && \
rm -r /tmp/pgpdf && \
apt-get remove -y pkg-config wget build-essential postgresql-server-dev-$PG_MAJOR && \
apt-get autoremove -y && \
apt-mark unhold locales && \
rm -rf /var/lib/apt/lists/*
23 changes: 21 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PG_CONFIG = pg_config
PKG_CONFIG = pkg-config

EXTENSION = pgpdf

EXTVERSION = 0.1.0
MODULE_big = $(EXTENSION)

OBJS = pgpdf.o
Expand Down Expand Up @@ -32,4 +32,23 @@ EXTRA_CLEAN = $(TEST_FILES)
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)

dev: clean all install installcheck
dev: clean all install installcheck

.PHONY: dist

dist:
mkdir -p dist
git archive --format zip --prefix=$(EXTENSION)-$(EXTVERSION)/ --output dist/$(EXTENSION)-$(EXTVERSION).zip main

# for Docker
PG_MAJOR ?= 17

.PHONY: docker

docker:
docker build --pull --no-cache --build-arg PG_MAJOR=$(PG_MAJOR) -t florents/pgpdf:pg$(PG_MAJOR) -t florents/pgpdf:$(EXTVERSION)-pg$(PG_MAJOR) .

.PHONY: docker-release

docker-release:
docker buildx build --push --pull --no-cache --platform linux/amd64,linux/arm64 --build-arg PG_MAJOR=$(PG_MAJOR) -t florents/pgpdf:pg$(PG_MAJOR) -t florents/pgpdf:$(EXTVERSION)-pg$(PG_MAJOR) .

0 comments on commit a8b5e2f

Please sign in to comment.