feat: Fix Docker test image
This commit is contained in:
parent
f84f7bb4b8
commit
4179c4d1ff
10
Dockerfile
10
Dockerfile
|
@ -1,19 +1,19 @@
|
|||
# TODO: make version variable?
|
||||
FROM postgres:9.6
|
||||
FROM postgres:10-beta1
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
postgresql-server-dev-${PG_MAJOR} \
|
||||
libphonenumber6 \
|
||||
libphonenumber-dev \
|
||||
sudo
|
||||
|
||||
CMD ["/data/run-tests.sh"]
|
||||
|
||||
COPY ./ /data/
|
||||
RUN chown -R postgres:postgres /data/
|
||||
|
||||
# Patch the entrypoint script so it always initializes the DB.
|
||||
RUN patch /usr/local/bin/docker-entrypoint.sh < /data/docker-entrypoint.patch
|
||||
|
||||
# Build pg_libphonenumber.
|
||||
WORKDIR /data
|
||||
RUN make && make install
|
||||
|
||||
CMD ["/data/run-tests.sh", "${PG_MAJOR}"]
|
||||
|
|
18
README.md
18
README.md
|
@ -1,4 +1,4 @@
|
|||
# pg-libphonenumber
|
||||
# pg_libphonenumber
|
||||
|
||||
A (partially implemented!) PostgreSQL extension that provides access to
|
||||
[Google's `libphonenumber`](https://github.com/googlei18n/libphonenumber)
|
||||
|
@ -31,9 +31,10 @@ First you'll need to install `libphonenumber-dev` and the corresponding
|
|||
`postgresql-server-dev` package.
|
||||
|
||||
```shell-script
|
||||
sudo apt-get install build-essential
|
||||
sudo apt-get install postgresql-server-dev-9.5
|
||||
sudo apt-get install libphonenumber-dev
|
||||
sudo apt-get update && sudo apt-get install \
|
||||
build-essential \
|
||||
postgresql-server-dev-9.6 \
|
||||
libphonenumber-dev
|
||||
```
|
||||
|
||||
Then clone this repository and build.
|
||||
|
@ -44,3 +45,12 @@ cd pg-libphonenumber
|
|||
make
|
||||
sudo make install
|
||||
```
|
||||
|
||||
## Running tests
|
||||
|
||||
For convenience, we provide a Docker image that sets up a test environment.
|
||||
|
||||
```shell-script
|
||||
make docker-image
|
||||
docker run pg_libphonenumber
|
||||
```
|
||||
|
|
14
run-tests.sh
14
run-tests.sh
|
@ -1,8 +1,10 @@
|
|||
#!/bin/sh
|
||||
PGDATA=/var/lib/postgresql/data
|
||||
# TODO: don't hard-code version here.
|
||||
pg_ctl=/usr/lib/postgresql/9.6/bin/pg_ctl
|
||||
gosu postgres $pg_ctl "--pgdata=$PGDATA" start -w
|
||||
gosu postgres make installcheck
|
||||
gosu postgres $pg_ctl "--pgdata=$PGDATA" stop
|
||||
|
||||
# Used in the Docker image to run tests
|
||||
|
||||
PGDATA=/var/lib/postgresql/data
|
||||
# Reads PG_MAJOR from the environment
|
||||
pg_ctl=/usr/lib/postgresql/${PG_MAJOR}/bin/pg_ctl
|
||||
$pg_ctl "--pgdata=${PGDATA}" start -w
|
||||
make installcheck
|
||||
$pg_ctl "--pgdata=${PGDATA}" stop
|
||||
|
|
Loading…
Reference in New Issue