From 0498290417e4689b2ffe806f97ed42d053d4aad6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Garc=C3=ADa=20Isa=C3=ADa?= Date: Tue, 12 Mar 2024 02:00:22 -0300 Subject: [PATCH 1/3] Unify Dockerfiles for app's prod & development Since the development image was basically a subset of the production one, we now unify them in a multi-stage image. See #721 --- Dockerfile | 4 +++- Dockerfile-dev | 16 ---------------- docker-compose.yml | 4 ++-- 3 files changed, 5 insertions(+), 19 deletions(-) delete mode 100644 Dockerfile-dev diff --git a/Dockerfile b/Dockerfile index 8d4131d9..12e35dbe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM clojure:lein-2.8.1 AS build +FROM clojure:lein-2.8.1 AS base RUN echo 'deb http://archive.debian.org/debian stretch main\n\ deb http://archive.debian.org/debian-security stretch/updates main' > /etc/apt/sources.list @@ -15,6 +15,8 @@ RUN apt update && \ WORKDIR /app +FROM base as build + COPY . /app RUN cd client && npm install && npm run release diff --git a/Dockerfile-dev b/Dockerfile-dev deleted file mode 100644 index c7b89a76..00000000 --- a/Dockerfile-dev +++ /dev/null @@ -1,16 +0,0 @@ -FROM clojure:lein-2.8.1 - -RUN echo 'deb http://archive.debian.org/debian stretch main\n\ - deb http://archive.debian.org/debian-security stretch/updates main' > /etc/apt/sources.list - -RUN apt update && \ - apt install -y build-essential cmake \ - libboost-timer-dev libboost-program-options-dev \ - libboost-filesystem-dev \ - libpq-dev libgdal-dev postgresql-client libpq-dev \ - gdal-bin python-gdal libgdal-java \ - && \ - curl -sL https://deb.nodesource.com/setup_9.x | bash - && \ - apt-get install -y nodejs - -WORKDIR /app diff --git a/docker-compose.yml b/docker-compose.yml index 89e0758d..c6fb60d5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,8 +3,8 @@ version: '2' services: app: build: - dockerfile: Dockerfile-dev context: . + target: base platform: linux/amd64 volumes: - ".:/app" @@ -21,8 +21,8 @@ services: client: build: - dockerfile: Dockerfile-dev context: . + target: base platform: linux/amd64 volumes: - ".:/app" From 62a817b00996909de4dfa937b918ab1d9c289681 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Garc=C3=ADa=20Isa=C3=ADa?= Date: Tue, 12 Mar 2024 02:03:41 -0300 Subject: [PATCH 2/3] Stop retrying apt packages installation in Docker The old retries were probably set up to workaround network issues in the old CI process. We don't need them now. See 500369fdda992fd4fb17bb5d58c1fc04c2cea405 See #721 --- Dockerfile | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 12e35dbe..89bc87ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,13 +29,10 @@ RUN echo 'deb http://archive.debian.org/debian stretch main\n\ deb http://archive.debian.org/debian-security stretch/updates main' > /etc/apt/sources.list # Install package dependencies and add precompiled binary -RUN for i in {1..5}; do \ - (apt-get update \ - && apt-get -y install postgresql-client gdal-bin python-gdal libgdal-java \ - && break) \ - || (sleep 5; false); done \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* +RUN apt-get update && \ + apt-get -y install postgresql-client gdal-bin python-gdal libgdal-java && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* # Add scripts COPY --from=build /app/scripts/ /app/scripts/ From 45e9ac1f30db79a7ca9ca96cfb23b5b852cd807e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Garc=C3=ADa=20Isa=C3=ADa?= Date: Tue, 12 Mar 2024 02:25:10 -0300 Subject: [PATCH 3/3] Split mapcache & mapserver Docker repos Instead of sharing a repository, make each of them have its own. See #721 --- build.sh | 4 ++-- docker-cloud.sample.yml | 4 ++-- docker-compose.production.yml | 4 ++-- mapserver/build-and-push.sh | 19 ------------------- mapserver/docker-compose.yml | 4 ++-- 5 files changed, 8 insertions(+), 27 deletions(-) delete mode 100755 mapserver/build-and-push.sh diff --git a/build.sh b/build.sh index f2e22a86..9b3b1938 100755 --- a/build.sh +++ b/build.sh @@ -13,6 +13,6 @@ if [[ -z "$DOCKER_TAG" ]]; then fi dockerBuildAndPush -dockerBuildAndPush -d mapserver -s "-mapserver" -t "-mapserver" -o "-f mapserver/Dockerfile.mapserver" -dockerBuildAndPush -d mapserver -s "-mapserver" -t "-mapcache" -o "-f mapserver/Dockerfile.mapcache" +dockerBuildAndPush -d mapserver -s "-mapserver" -o "-f mapserver/Dockerfile.mapserver" +dockerBuildAndPush -d mapserver -s "-mapcache" -o "-f mapserver/Dockerfile.mapcache" dockerBuildAndPush -d scripts -s "-tools" diff --git a/docker-cloud.sample.yml b/docker-cloud.sample.yml index 6f900e70..a5716585 100644 --- a/docker-cloud.sample.yml +++ b/docker-cloud.sample.yml @@ -21,12 +21,12 @@ web: - mapserver-data mapcache: - image: instedd/planwise-mapserver:kenya-mapcache + image: instedd/planwise-mapcache:kenya autorestart: always autoredeploy: true mapserver: - image: instedd/planwise-mapserver:kenya-mapserver + image: instedd/planwise-mapserver:kenya autorestart: always autoredeploy: true volumes_from: diff --git a/docker-compose.production.yml b/docker-compose.production.yml index 05235007..93d02624 100644 --- a/docker-compose.production.yml +++ b/docker-compose.production.yml @@ -34,12 +34,12 @@ services: mapcache: container_name: planwise-prod-mapcache - image: instedd/planwise-mapserver:kenya-mapcache + image: instedd/planwise-mapcache:kenya pid: host mapserver: container_name: planwise-prod-mapserver - image: instedd/planwise-mapserver:kenya-mapserver + image: instedd/planwise-mapserver:kenya pid: host volumes: - data:/data diff --git a/mapserver/build-and-push.sh b/mapserver/build-and-push.sh deleted file mode 100755 index 9c823d7c..00000000 --- a/mapserver/build-and-push.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -if [ $# -lt 1 ]; then - tag=`git rev-parse --abbrev-ref HEAD` -else - tag=$1 -fi -echo Using $tag as the version tag. Will build and push: -echo - instedd/planwise-mapserver:mapserver-$tag -echo - instedd/planwise-mapserver:mapcache-$tag -echo -read -p "Press Enter to continue, Ctrl+C to cancel: " dummy - -docker build -t instedd/planwise-mapserver:mapserver-$tag -f Dockerfile.mapserver . -docker push instedd/planwise-mapserver:mapserver-$tag - -docker build -t instedd/planwise-mapserver:mapcache-$tag -f Dockerfile.mapcache . -docker push instedd/planwise-mapserver:mapcache-$tag - diff --git a/mapserver/docker-compose.yml b/mapserver/docker-compose.yml index e93620aa..253dfa70 100644 --- a/mapserver/docker-compose.yml +++ b/mapserver/docker-compose.yml @@ -1,5 +1,5 @@ mapcache: - image: instedd/planwise-mapserver:mapcache + image: instedd/planwise-mapcache # build: . # dockerfile: Dockerfile.mapcache volumes: @@ -10,7 +10,7 @@ mapcache: - "5002:80" mapserver: - image: instedd/planwise-mapserver:mapserver + image: instedd/planwise-mapserver # build: . # dockerfile: Dockerfile.mapserver volumes: