Skip to content

Commit

Permalink
Tiny fixes: docker autover, default user (#379)
Browse files Browse the repository at this point in the history
* On tag, make sure the python code version is dynamically updated before creating a docker file
* minor generate-tiles code cleanup (i will need to do much more on that script, but good enough for now). No code changes.
* Create a new group/user in the openmaptiles docker image called `openmaptiles`. This prevents "i have no name" prompt when running docker tool image.
  • Loading branch information
nyurik authored Oct 12, 2021
1 parent df78531 commit 7207296
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ jobs:
# This means that the two-part version image will always point to latest patch.
export VERSION="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.${BASH_REMATCH[3]} \
${BASH_REMATCH[1]}.${BASH_REMATCH[2]}"
echo "Current content of openmaptiles/__init__.py:"
cat openmaptiles/__init__.py
echo "Updating version in openmaptiles/__init__.py to ${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.${BASH_REMATCH[3]}"
sed -i -e 's/^__version__ = '"'"'[0-9]\+[.][0-9]\+[.][0-9]\+'"'"'/__version__ = '"'${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.${BASH_REMATCH[3]}'"'/g' openmaptiles/__init__.py
echo "New content of openmaptiles/__init__.py:"
cat openmaptiles/__init__.py
else
echo "Unrecognized ref ${GITHUB_REF}, no docker images are built or uploaded"
exit 0
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ RUN set -eux ;\
/bin/bash -c 'echo ""; echo ""; echo "##### Cleaning up"' >&2 ;\
rm -rf /var/lib/apt/lists/*

RUN groupadd --gid 1000 openmaptiles \
&& useradd --uid 1000 --gid openmaptiles --shell /bin/bash --create-home openmaptiles

# Copy requirements.txt first to avoid pip install on every code change
COPY ./requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
Expand Down
6 changes: 3 additions & 3 deletions bin/generate-tiles
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ export PGPORT="${POSTGRES_PORT:-${PGPORT:-5432}}"

# List of postgres servers
# "xxx.xxx.xxx.xxx&host=xxx.xxx.xxx.xxx&host=..."
if [[ -z "${PGHOSTS_LIST}" ]]
then
if [[ -z "${PGHOSTS_LIST}" ]]; then
export HOST_COUNT=1
export PGHOSTS="${POSTGRES_HOST:-${PGHOST?}}"
else
export HOST_COUNT=`awk -F"&" '{print NF}' <<< "${PGHOSTS_LIST}"`
HOST_COUNT=$(awk -F"&" '{print NF}' <<< "${PGHOSTS_LIST}")
export HOST_COUNT
export PGHOSTS="${PGHOSTS_LIST}"
fi

Expand Down
2 changes: 1 addition & 1 deletion docker/postgis/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ RUN set -eux ;\
libkakasi2-dev \
libgdal-dev \
;\
## Install specific GEOS version
## Install specific GEOS version
cd /opt/ ;\
curl -o /opt/geos.tar.bz2 http://download.osgeo.org/geos/geos-${GEOS_VER}.tar.bz2 ;\
mkdir /opt/geos ;\
Expand Down
2 changes: 1 addition & 1 deletion docs/LocalDocker.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Connect local `openmaptiles-tools` with local `openmaptiles`:

Very helpful for contributors who want to develop and test `openmaptiles-tools` with `openmaptiles` together.
Very helpful for contributors who want to develop and test `openmaptiles-tools` with `openmaptiles` together.

### Change docker path in `docker-compose.yml`

Expand Down

0 comments on commit 7207296

Please sign in to comment.