Skip to content

Commit 0807180

Browse files
committed
dev: upgrade to use docker instead of vagrant for building releases
1 parent d33c1ac commit 0807180

File tree

4 files changed

+84
-246
lines changed

4 files changed

+84
-246
lines changed

Dockerfile

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Dockerfile to build Imposm releases for Linux
2+
# ---------------------------------------------
3+
#
4+
# It installs and builds all dependencies, compiles the master
5+
# branch of this local repository and creates a .tar.gz with
6+
# the imposm binary and all 3rd party dependencies.
7+
#
8+
# This script is made for Debian 10. The resulting binaries
9+
# should be compatible with all more recent Linux distribution.
10+
#
11+
# Release tar.gz is copied to /imposm/dist, use mounts to get the file.
12+
# Example:
13+
# podman build -t imposm-build-debian10 .
14+
# podman run --rm -v ./dist:/imposm/dist -t imposm-build-debian10
15+
16+
FROM debian:10
17+
18+
RUN apt-get update && \
19+
apt-get install -y \
20+
build-essential \
21+
unzip \
22+
autoconf \
23+
libtool \
24+
git \
25+
cmake \
26+
patchelf \
27+
curl \
28+
&& \
29+
rm -rf /var/lib/apt/lists/*
30+
31+
WORKDIR /imposm
32+
33+
ARG PREFIX=/imposm/local
34+
35+
ENV CGO_CFLAGS=-I$PREFIX/include
36+
ENV CGO_LDFLAGS=-L$PREFIX/lib
37+
ENV LD_LIBRARY_PATH=$PREFIX/lib
38+
39+
RUN mkdir -p $PREFIX/lib && mkdir -p $PREFIX/include
40+
41+
ARG GOLANG_VERSION=1.24.0
42+
RUN curl -L -O https://go.dev/dl/go$GOLANG_VERSION.linux-amd64.tar.gz && \
43+
rm -rf /usr/local/go && tar -C /usr/local -xzf go$GOLANG_VERSION.linux-amd64.tar.gz && \
44+
rm go$GOLANG_VERSION.linux-amd64.tar.gz
45+
ENV PATH="$PATH:/usr/local/go/bin"
46+
47+
48+
ARG LEVELDB_VERSION=1.23
49+
RUN curl -L https://github.com/google/leveldb/archive/refs/tags/$LEVELDB_VERSION.tar.gz | \
50+
tar -xz && \
51+
cd leveldb-$LEVELDB_VERSION && \
52+
mkdir -p build && cd build && \
53+
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DLEVELDB_BUILD_TESTS=OFF -DLEVELDB_BUILD_BENCHMARKS=OFF .. && \
54+
cmake --build . && \
55+
cp -R ./liblevel* $PREFIX/lib/ && \
56+
cp -R ../include/leveldb $PREFIX/include/
57+
58+
59+
ARG GEOS_VERSION=3.12.2
60+
RUN curl -L http://download.osgeo.org/geos/geos-$GEOS_VERSION.tar.bz2 | tar -jx && \
61+
cd geos-$GEOS_VERSION/ && \
62+
./configure --prefix=$PREFIX && make -j2 && make install
63+
64+
RUN mkdir src && git config --global --add safe.directory src
65+
COPY . src
66+
67+
RUN cd src && make build
68+
69+
RUN mkdir -p build \ && \
70+
cp src/imposm build/ && \
71+
cp src/README.md build/ && \
72+
cp src/example-mapping.json build/mapping.json && \
73+
mkdir -p build/lib && \
74+
cp $PREFIX/lib/libgeos_c.so build/lib && \
75+
ln -s libgeos_c.so build/lib/libgeos_c.so.1 && \
76+
cp $PREFIX/lib/libgeos.so build/lib && \
77+
ln -s libgeos.so build/lib/libgeos.so.$GEOS_VERSION && \
78+
cp -R $PREFIX/lib/libleveldb.so* build/lib && \
79+
patchelf --set-rpath '$ORIGIN' build/lib/libgeos_c.so
80+
81+
82+
CMD bash -c 'cd /imposm && VERSION=$(./build/imposm version)-linux-x86-64 && mv build imposm-$VERSION && tar zcvf dist/imposm-$VERSION.tar.gz imposm-$VERSION'
83+

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ You can also directly use go to build or install imposm with `go build ./cmd/imp
122122
Go compiles to static binaries and so Imposm has no runtime dependencies to Go.
123123
Just copy the `imposm` binary to your server for deployment. The C/C++ libraries listed above are still required though.
124124

125-
See also `packaging.sh` for instructions on how to build binary packages for Linux.
125+
See also `Dockerfile` for instructions on how to build standalone binary packages for Linux.
126126

127127
#### LevelDB
128128

Vagrantfile

-71
This file was deleted.

packaging.sh

-174
This file was deleted.

0 commit comments

Comments
 (0)