Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use builder images in dockerfiles #860

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
.gitignore
.git
Dockerfile
Dockerfile.centos7
Dockerfile.centos
20 changes: 14 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,40 @@ sudo: false

matrix:
include:
# test on docker+centos7
# test on docker+centos
- os: linux
compiler: clang
services:
- docker
sudo: true
dist: trusty
env: DOCKERFILE=Dockerfile.centos7
dist: bionic
env: DOCKERFILE=Dockerfile.centos
before_install: []
# build the builder image separately to run the tests
install:
- docker build -t tippecanoe-image-builder -f ${DOCKERFILE} . --target=builder
- docker build -t tippecanoe-image -f ${DOCKERFILE} .
# run tippecanoe --help to make sure runtime libs are correct
script:
- docker run -it tippecanoe-image
- docker run -it tippecanoe-image-builder
- docker run -it tippecanoe-image tippecanoe --help
# test on docker+ubuntu
- os: linux
compiler: clang
services:
- docker
sudo: true
dist: trusty
dist: bionic
env: DOCKERFILE=Dockerfile
before_install: []
# build the builder image separately to run the tests
install:
- docker build -t tippecanoe-image-builder -f ${DOCKERFILE} . --target=builder
- docker build -t tippecanoe-image -f ${DOCKERFILE} .
# run tippecanoe --help to make sure runtime libs are correct
script:
- docker run -it tippecanoe-image
- docker run -it tippecanoe-image-builder
- docker run -it tippecanoe-image tippecanoe --help
# debug+integer-santizer build
- os: linux
compiler: clang
Expand Down
23 changes: 18 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Allow setting version as an argument
ARG UBUNTU_VERSION=20.04

# Start from ubuntu
FROM ubuntu:16.04
FROM ubuntu:${UBUNTU_VERSION} as builder

# Update repos and install dependencies
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get -y install build-essential libsqlite3-dev zlib1g-dev
&& apt-get -y install make gcc g++ libsqlite3-dev zlib1g-dev

# Create a directory and copy in all files
RUN mkdir -p /tmp/tippecanoe-src
# Copy in all files
WORKDIR /tmp/tippecanoe-src
COPY . /tmp/tippecanoe-src

Expand All @@ -17,3 +18,15 @@ RUN make \

# Run the tests
CMD make test

# Build final image
FROM ubuntu:${UBUNTU_VERSION}

# Install runtime dependencies
RUN apt-get update \
&& apt-get install -y libsqlite3-0 zlib1g \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Copy built files into final image
COPY --from=builder /usr/local/ /usr/local/
27 changes: 27 additions & 0 deletions Dockerfile.centos
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
ARG CENTOS_VERSION=8

# Start from centos
FROM centos:${CENTOS_VERSION} as builder

# Intall dependencies
RUN yum install -y make sqlite-devel zlib-devel gcc-c++ diffutils perl

# Copy in all files
WORKDIR /tmp/tippecanoe-src
COPY . /tmp/tippecanoe-src

# Build tippecanoe
RUN make \
&& make install

# Run the tests
CMD make test

# Build final image
FROM centos:${CENTOS_VERSION}

# Install runtime dependencies
RUN yum install -y sqlite-libs zlib

# Copy built files into final image
COPY --from=builder /usr/local/ /usr/local/
15 changes: 0 additions & 15 deletions Dockerfile.centos7

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ uses md2man (`gem install md2man`).

Linux:

sudo apt-get install build-essential libsqlite3-dev zlib1g-dev
sudo apt-get install gcc g++ make libsqlite3-dev zlib1g-dev

Then build:

Expand Down