Skip to content

Commit

Permalink
Add multistage build
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Sep 5, 2024
1 parent 6d170f9 commit 6f72cda
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions tasks/data/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
FROM ubuntu:24.04
FROM ubuntu:24.04 as build

ENV HOME=/home/etl
WORKDIR $HOME

RUN apt update \
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends apt-utils tzdata \
&& apt install -y build-essential curl cmake autoconf libtool
&& apt-get install -y build-essential curl cmake autoconf libtool software-properties-common git libsqlite3-dev \
&& apt-get install -y python3 python3-pip python3-dev python3-setuptools

RUN export NODEV='22.8.0' \
&& curl "https://nodejs.org/dist/v${NODEV}/node-v${NODEV}-linux-x64.tar.gz" | tar -xzv > /dev/null \
&& cp ./node-v${NODEV}-linux-x64/bin/node /usr/bin/ \
&& ./node-v${NODEV}-linux-x64/bin/npm install -g npm
&& ./node-v${NODEV}-linux-x64/bin/npm install -g npm

RUN npm install --global aws-lambda-ric

# PMTiles: https://github.com/protomaps/go-pmtiles/releases
RUN curl -L https://github.com/protomaps/go-pmtiles/releases/download/v1.20.0/go-pmtiles_1.20.0_Linux_x86_64.tar.gz > /tmp/pmtiles.tar.gz && \
tar -xzvf /tmp/pmtiles.tar.gz && \
mv pmtiles /usr/bin/
mv pmtiles /usr/local/bin/

# TippeCanoe: https://github.com/felt/tippecanoe/releases
RUN git clone -b 2.60.0 --depth 1 https://github.com/felt/tippecanoe.git /tmp/tippecanoe && \
Expand All @@ -26,6 +27,20 @@ RUN git clone -b 2.60.0 --depth 1 https://github.com/felt/tippecanoe.git /tmp/ti
PREFIX=/usr/local make install && \
rm -rf /tmp/tippecanoe

FROM ubuntu:24.04 as runtime

COPY --from=0 /usr/local/bin/pmtiles* /usr/local/bin/
COPY --from=0 /usr/local/bin/tippecanoe* /usr/local/bin/
COPY --from=0 /usr/local/bin/tile-join /usr/local/bin/

RUN apt-get update \
&& apt-get install -y curl gdal-bin

RUN export NODEV='22.8.0' \
&& curl "https://nodejs.org/dist/v${NODEV}/node-v${NODEV}-linux-x64.tar.gz" | tar -xzv > /dev/null \
&& cp ./node-v${NODEV}-linux-x64/bin/node /usr/bin/ \
&& ./node-v${NODEV}-linux-x64/bin/npm install -g npm

COPY ./ $HOME/task
WORKDIR $HOME/task

Expand Down

0 comments on commit 6f72cda

Please sign in to comment.