This repository has been archived by the owner on Oct 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DockerfileForCartoSQLAPI
154 lines (137 loc) · 4.69 KB
/
DockerfileForCartoSQLAPI
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# vim:set filetype=dockerfile:
FROM ubuntu:18.04
# CartoDB installations assume UTF-8. Configure locales accordingly:
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update &&\
apt-get install -y \
locales \
apt-utils &&\
dpkg-reconfigure locales &&\
locale-gen en_US.UTF-8 &&\
update-locale LANG=en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
# 1. Create a 'cartodb' user.
# 2. Update apt-get and install various utils and build tools.
# See http://cartodb.readthedocs.io/en/latest/install.html
# NOTE that PostgreSQL is NOT installed into this container.
RUN useradd -m -d /home/cartodb -s /bin/bash cartodb &&\
apt-get install -y --no-install-recommends \
# This is needed for add-apt-repository.
# See http://unix.stackexchange.com/a/45905/18918
software-properties-common \
# Carto maintains packaged versions of almost every part of the stack,
# but there are some parts like gems and npm packages that need
# these dev tools to be system installed in order to compile.
autoconf \
binutils-doc \
bison \
build-essential \
checkinstall \
flex \
# These packages are needed for Ruby and the rvm installation.
gnupg \
libreadline6-dev \
openssl \
# tcpflow for troubleshooting, https://askubuntu.com/a/654993/17122
tcpflow \
# See https://github.com/sverhoeven/docker-cartodb/blob/master/Dockerfile
gdal-bin \
libgdal-dev \
# Tools to grab sources...
wget \
git \
# Vim and ping for troubleshooting containers.
vim \
iputils-ping \
# I don't know that these are needed. They are
# from https://github.com/sverhoeven/docker-cartodb/blob/master/Dockerfile
# which does not document why they are included, but I don't have
# time right now to look into each one.
automake \
ca-certificates \
checkinstall \
curl \
git-core \
imagemagick \
libc6-dev \
libcairo2-dev \
libcurl4-gnutls-dev \
libffi-dev \
libgdbm-dev \
libgif-dev \
libgmp-dev \
libicu-dev \
libjpeg8-dev \
libmapnik-dev \
libpq-dev \
libpq5 \
libreadline7 \
libreadline6-dev \
libsqlite3-dev \
libssl-dev \
libtool \
libxml2-dev \
libxslt-dev \
libyaml-dev \
mapnik-utils \
ncurses-dev \
pkg-config \
zlib1g \
zlib1g-dev
# These configs improve bash and Vim.
# COPY ["db/dotfiles/*","/root/"]
# COPY ["db/dotfiles/*","/home/carto/"]
RUN apt-get install -y \
zip \
# Install Proj4 for reprojection support.
proj-bin \
proj-data \
libproj-dev \
# Install this stuff for JSON/GeoJSON support.
libjson-c-dev \
python-simplejson \
# Install GEOS for geometry function support.
libgeos-c1v5 \
libgeos-dev \
# Having this avoids errors about cairo not being found...
libpango1.0-dev \
# Install the Postgres *client* software.
# This does not install the full database server.
postgresql-client-10
# Install Python requirements
RUN wget -O /tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py &&\
python /tmp/get-pip.py &&\
apt-get install -y \
python-all-dev \
python-gdal &&\
# Clear the cache.
rm -rf /var/lib/apt/lists/*
# Install NodeJS
# Version 6.9.2 is currently recommended in the README.
RUN curl https://nodejs.org/download/release/v6.9.2/node-v6.9.2-linux-x64.tar.gz| tar -zxf - --strip-components=1 -C /usr
# Default to production:
# https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md
# Set NODE_PATH so globally installed modules will be found.
# https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
ENV NODE_ENV=production NODE_PATH=/usr/local/lib/node_modules
# Install SQL API
RUN git clone https://github.com/CartoDB/CartoDB-SQL-API.git &&\
cd CartoDB-SQL-API &&\
# Change the message if you change the changeset ID!
echo "Checking out CartoDB-SQL-API release 2.2.0 (2018-07-25) ..." &&\
git checkout d53b7bb5f9619e56b362e38b8b1001c2760f0a03
RUN cd CartoDB-SQL-API ./configure && npm install
ENV PATH /usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV GDAL_DATA /usr/share/gdal/2.2
COPY ./carto/config/carto-sql-api-dev.js \
/CartoDB-SQL-API/config/environments/development.js
# Our custom config controls if a secret secures connections to the
# varnish admin console.
COPY ./carto/varnish \
/etc/default/varnish
EXPOSE 8080
WORKDIR /CartoDB-SQL-API
# https://www.ctl.io/developers/blog/post/dockerfile-entrypoint-vs-cmd
ENTRYPOINT node app.js