tileserver-gl/Dockerfile
Til Schneider 5b7f291c3a
Make subsequent calls of npm run docker faster
This makes subsequent calls of `npm run docker` a lot faster if source code was changed.

How it works:
- The build step only executes `npm install`. So it only needs the `package.json` file.
- By copying the whole project folder as late as possible, docker can use cached layers for all previous steps. This includes long-running steps like `apt-get` and `npm install`.
2021-05-21 17:09:08 +02:00

57 lines
1.1 KiB
Docker

FROM node:10-buster AS builder
RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get -qq update \
&& apt-get -y --no-install-recommends install \
apt-transport-https \
curl \
unzip \
build-essential \
python \
libcairo2-dev \
libgles2-mesa-dev \
libgbm-dev \
libllvm7 \
libprotobuf-dev \
&& apt-get -y --purge autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY package.json /usr/src/app/package.json
ENV NODE_ENV="production"
RUN cd /usr/src/app && npm install --production
FROM node:10-buster-slim AS final
RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get -qq update \
&& apt-get -y --no-install-recommends install \
libgles2-mesa \
libegl1 \
xvfb \
xauth \
&& apt-get -y --purge autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir /app
COPY --from=builder /usr/src/app/node_modules /app/node_modules
COPY . /app
ENV NODE_ENV="production"
ENV CHOKIDAR_USEPOLLING=1
ENV CHOKIDAR_INTERVAL=500
VOLUME /data
WORKDIR /data
EXPOSE 80
USER node:node
ENTRYPOINT ["/app/docker-entrypoint.sh"]
CMD ["-p", "80"]