Run docker test against Node.js 10

This commit is contained in:
Daniel García Aubert 2018-10-31 14:47:32 +01:00
parent 420c39337c
commit e57e548c31
6 changed files with 111 additions and 8 deletions

View File

@ -3,9 +3,17 @@ jobs:
- sudo: required
services:
- docker
language: generic
node_js:
- "6"
before_install: docker pull carto/nodejs6-xenial-pg101:postgis-2.4.4.5
script: npm run docker-test
script: npm run docker-test -- nodejs6-xenial-pg101:postgis-2.4.4.5
- sudo: required
services:
- docker
node_js:
- "10"
before_install: docker pull carto/nodejs10-xenial-pg101:postgis-2.4.4.5
script: npm run docker-test -- nodejs10-xenial-pg101:postgis-2.4.4.5
- dist: precise
addons:
postgresql: "9.5"

3
docker-bash.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
docker run -it -v `pwd`:/srv carto/${1:-nodejs10-xenial-pg101:postgis-2.4.4.5} bash

4
docker-test.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
docker run -v `pwd`:/srv carto/${1:-nodejs10-xenial-pg101:postgis-2.4.4.5} bash run_tests_docker.sh && \
docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v

View File

@ -0,0 +1,88 @@
FROM ubuntu:xenial
# Use UTF8 to avoid encoding problems with pgsql
ENV LANG C.UTF-8
ENV NPROCS 1
ENV JOBS 1
ENV CXX g++-4.9
ENV PGUSER postgres
# Add external repos
RUN set -ex \
&& apt-get update \
&& apt-get install -y \
curl \
software-properties-common \
locales \
&& add-apt-repository -y ppa:ubuntu-toolchain-r/test \
&& add-apt-repository -y ppa:cartodb/postgresql-10 \
&& add-apt-repository -y ppa:cartodb/gis \
&& curl -sL https://deb.nodesource.com/setup_10.x | bash \
&& locale-gen en_US.UTF-8 \
&& update-locale LANG=en_US.UTF-8
RUN set -ex \
&& apt-get update \
&& apt-get install -y \
g++-4.9 \
gcc-4.9 \
git \
libcairo2-dev \
libgdal-dev \
libgdal1i \
libgdal20 \
libgeos-dev \
libgif-dev \
libjpeg8-dev \
libjson-c-dev \
libpango1.0-dev \
libpixman-1-dev \
libproj-dev \
libprotobuf-c-dev \
libxml2-dev \
gdal-bin \
make \
nodejs \
protobuf-c-compiler \
pkg-config \
wget \
zip \
postgresql-10 \
postgresql-10-plproxy \
postgis=2.4.4.5+carto-1 \
postgresql-10-postgis-2.4=2.4.4.5+carto-1 \
postgresql-10-postgis-2.4-scripts=2.4.4.5+carto-1 \
postgresql-10-postgis-scripts=2.4.4.5+carto-1 \
postgresql-client-10 \
postgresql-client-common \
postgresql-common \
postgresql-contrib \
postgresql-plpython-10 \
postgresql-server-dev-10 \
&& wget http://download.redis.io/releases/redis-4.0.8.tar.gz \
&& tar xvzf redis-4.0.8.tar.gz \
&& cd redis-4.0.8 \
&& make \
&& make install \
&& cd .. \
&& rm redis-4.0.8.tar.gz \
&& rm -R redis-4.0.8 \
&& apt-get purge -y wget protobuf-c-compiler \
&& apt-get autoremove -y
# Configure PostgreSQL
RUN set -ex \
&& echo "listen_addresses='*'" >> /etc/postgresql/10/main/postgresql.conf \
&& echo "local all all trust" > /etc/postgresql/10/main/pg_hba.conf \
&& echo "host all all 0.0.0.0/0 trust" >> /etc/postgresql/10/main/pg_hba.conf \
&& echo "host all all ::1/128 trust" >> /etc/postgresql/10/main/pg_hba.conf \
&& /etc/init.d/postgresql start \
&& createdb template_postgis \
&& createuser publicuser \
&& psql -c "CREATE EXTENSION postgis" template_postgis \
&& /etc/init.d/postgresql stop
WORKDIR /srv
EXPOSE 5858
CMD /etc/init.d/postgresql start

View File

@ -11,13 +11,13 @@ https://hub.docker.com/r/carto/
## Update image
- Edit the docker image file with your desired changes
- Build image:
- Build image:
- `docker build -t carto/IMAGE -f docker/DOCKER_FILE docker/`
- Upload to docker hub:
- Login into docker hub:
- Login into docker hub:
- `docker login`
- Create tag:
- Create tag:
- `docker tag carto/IMAGE carto/IMAGE`
- Upload:
- Upload:
- `docker push carto/IMAGE`

View File

@ -66,8 +66,8 @@
"preinstall": "make pre-install",
"test": "make test-all",
"update-internal-deps": "rm -rf node_modules && rm -f yarn.lock && yarn",
"docker-test": "docker run -v `pwd`:/srv carto/nodejs6-xenial-pg101:postgis-2.4.4.5 bash run_tests_docker.sh && docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v",
"docker-bash": "docker run -it -v `pwd`:/srv carto/nodejs6-xenial-pg101 bash"
"docker-test": "./docker-test.sh",
"docker-bash": "./docker-bash.sh"
},
"engines": {
"node": ">=6.9",