diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..d075b3e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.git +.vagrant +build diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6739af0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM debian:jessie +MAINTAINER Dimitri Fontaine + +RUN apt-get update +RUN apt-get install -y wget curl make git bzip2 time libzip-dev libssl1.0.0 openssl +RUN apt-get install -y patch unzip libsqlite3-dev gawk freetds-dev sbcl + +RUN mkdir -p /opt/src/pgloader +RUN git clone https://github.com/dimitri/pgloader /opt/src/pgloader + +# we have build in the .dockerignore file, but we actually need it now +RUN mkdir -p /opt/src/pgloader/build/bin +RUN make PWD=/opt/src/pgloader -C /opt/src/pgloader + +RUN cp /opt/src/pgloader/build/bin/pgloader /usr/local/bin diff --git a/INSTALL.md b/INSTALL.md index f200a47..164fb3d 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -92,65 +92,13 @@ Now the `./build/bin/pgloader` that you get only uses 1GB. ## Building a docker image -We start with a `debian` image: +A `Dockerfile` is provided, to use it: - docker run -it debian bash + docker build -t pgloader:debian . + docker run --rm --name pgloader pgloader:debian bash -c "pgloader --version" -And then run the following steps: +The `build` step install build dependencies in a debian jessie container, +then `git clone` and build `pgloader` in `/opt/src/pgloader` and finally +copy the resulting binary image in `/usr/local/bin/pgloader` so that it's +easily available. - # apt-get update - # apt-get install -y wget curl make git bzip2 time libzip-dev openssl-dev - # apt-get install -y patch unzip libsqlite3-dev gawk freetds-dev - # useradd -m -s /bin/bash dim - # su - dim - -Install a binary version on SBCL, which unfortunately has no support for -core compression, so only use it to build another SBCL version from sources -with proper options: - - $ mkdir sbcl - $ cd sbcl - $ wget http://prdownloads.sourceforge.net/sbcl/sbcl-1.2.6-x86-64-linux-binary.tar.bz2 - $ wget http://prdownloads.sourceforge.net/sbcl/sbcl-1.2.6-source.tar.bz2?download - $ mv sbcl-1.2.6-source.tar.bz2\?download sbcl-1.2.6-source.tar.bz2 - $ tar xf sbcl-1.2.6-x86-64-linux-binary.tar.bz2 - $ tar xf sbcl-1.2.6-source.tar.bz2 - $ exit - -Install SBCL as root - - # cd /home/dim/sbcl/sbcl-1.2.6-x86-64-linux - # bash install.sh - -Now back as the unprivileged user (dim) to compile SBCL from sources: - - # su - dim - $ cd sbcl/sbcl-1.2.6 - $ sh make.sh --with-sb-core-compression --with-sb-thread > build.out 2>&1 - $ exit - -And install the newly compiled SBCL as root: - - # cd /home/dim/sbcl/sbcl-1.2.6 - # sh install.sh - -Now build pgloader from sources: - - # su - dim - $ git clone https://github.com/dimitri/pgloader - $ cd pgloader - $ make - $ ./build/bin/pgloader --help - $ exit - -Now install pgloader in `/usr/local/bin` to make it easy to use: - - # cp /home/dim/pgloader/build/bin/pgloader /usr/local/bin - # pgloader --version - -Commit the docker instance and push it, from the host: - - $ docker login - $ docker ps -l - $ docker commit dimitri/pgloader-3.1.cd52654 - $ docker push dimitri/pgloader-3.1.cd52654