Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
141 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
* | ||
!setup.py | ||
!requirements.txt | ||
!README.rst | ||
!CHANGES.rst | ||
!tilecloud_chain/* | ||
tilecloud_chain/tests | ||
!docker/run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
FROM ubuntu:16.04 | ||
MAINTAINER Stéphane Brunner <stephane.brunner@camptocamp.com> | ||
|
||
RUN \ | ||
apt-get update && \ | ||
apt-get install --assume-yes --no-install-recommends wget ca-certificates python python-mapnik mapnik-utils gdal-bin libpq5 libgeos-c1v5 fonts-dejavu node-carto osm2pgsql curl unzip && \ | ||
cd /tmp && \ | ||
wget https://bootstrap.pypa.io/get-pip.py && \ | ||
python get-pip.py && \ | ||
mkdir /fonts && \ | ||
mkdir /project && \ | ||
apt-get remove --assume-yes --purge wget ca-certificates && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /root/.cache/* | ||
|
||
COPY . /src/ | ||
RUN \ | ||
apt-get update && \ | ||
apt-get install --assume-yes --no-install-recommends gcc python-dev libpq-dev libgeos-dev libmapnik-dev && \ | ||
cd /src && \ | ||
mv docker/run /usr/bin/ && \ | ||
pip install -r requirements.txt && \ | ||
pip install . && \ | ||
apt-get remove --assume-yes --purge gcc python-dev libpq-dev libgeos-dev libmapnik-dev && \ | ||
apt-get autoremove --assume-yes && \ | ||
apt-get clean && \ | ||
rm -rf /src /var/lib/apt/lists/* /tmp/* /var/tmp/* /root/.cache/* | ||
|
||
WORKDIR /project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/python | ||
|
||
import os | ||
import sys | ||
import stat | ||
import subprocess | ||
import tempfile | ||
|
||
if 'GROUP_ID' not in os.environ: | ||
exit('The GROUP_ID environment variable is required') | ||
|
||
if 'USER_ID' not in os.environ: | ||
exit('The USER_ID environment variable is required') | ||
|
||
if 'USER_NAME' not in os.environ: | ||
exit('The USER_NAME environment variable is required') | ||
|
||
if 'UMASK' not in os.environ: | ||
exit('The UMASK environment variable is required') | ||
|
||
subprocess.check_call(['groupadd', '-g', os.environ['GROUP_ID'], 'geomapfish']) | ||
subprocess.check_call(['useradd', '--shell', '/bin/bash', '--uid', os.environ['USER_ID'], '--gid', os.environ['GROUP_ID'], os.environ['USER_NAME']]) | ||
|
||
run_file_name = "/tmp/run" | ||
with open(run_file_name, 'w') as run_file: | ||
run_file.write('#!/usr/bin/python\n') | ||
run_file.write('import subprocess, os\n') | ||
run_file.write('os.umask(0o{})\n'.format(os.environ['UMASK'])) | ||
run_file.write('subprocess.check_call({})\n'.format(repr(sys.argv[1:]))) | ||
|
||
os.chmod(run_file_name, stat.S_IRUSR | stat.S_IXUSR | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH) | ||
subprocess.check_call(["su", os.environ['USER_NAME'], "-c", run_file_name]) |