From cc902b47c1e53320d86afc1bdacd0d65a3882267 Mon Sep 17 00:00:00 2001
From: antoineludeau <52679050+antoineludeau@users.noreply.github.com>
Date: Thu, 11 Jan 2024 16:34:03 +0100
Subject: [PATCH 1/3] Improved local deployment with docker
---
.dockerignore | 58 ++++++++++++++++++++++++++++++++++++++++++++++
Dockerfile.dev | 2 +-
docker-compose.yml | 42 +++++++++++++++++++++++++++++----
3 files changed, 97 insertions(+), 5 deletions(-)
create mode 100644 .dockerignore
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 000000000..ee85e0a0c
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,58 @@
+# Environment config
+.env*
+
+# Runtime
+pids
+*.pid
+*.seed
+*.pid.lock
+
+# Logs
+logs
+*.log
+npm-debug.log*
+CHANGELOG.md
+
+# Mac
+*.DS_Store
+.AppleDouble
+.LSOverride
+
+# Build
+.next
+
+# Cache
+.yarn-cache
+.npm
+.eslintcache
+.changelog
+
+# Node
+node_modules
+
+# Reports
+coverage
+reports
+
+# Git config
+.git
+.github
+.gitignore
+
+#Editor Config
+.editorconfig
+
+#Docker config
+Dockerfile*
+docker-compose.yml
+.dockerignore
+
+#Babel config
+.babelrc
+
+#Scalingo config
+scalingo.json
+
+#Other
+*.md
+LICENSE
\ No newline at end of file
diff --git a/Dockerfile.dev b/Dockerfile.dev
index cb0e41a0d..eee2ecebd 100644
--- a/Dockerfile.dev
+++ b/Dockerfile.dev
@@ -3,7 +3,7 @@ FROM node:16.19.0-alpine
WORKDIR /app
# installing dependencies
-COPY package.json yarn.lock .
+COPY package.json yarn.lock ./
RUN mkdir public
RUN yarn install
diff --git a/docker-compose.yml b/docker-compose.yml
index 59504765c..1b82f37c0 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -4,8 +4,42 @@ services:
dockerfile: 'Dockerfile.dev'
container_name: frontend
volumes:
- - ./:/app
- - /app/node_modules
- - /app/.next
+ - ./build/:/app/build
+ - ./components/:/app/components
+ - ./contexts/:/app/contexts
+ - ./data/:/app/data
+ - ./hooks/:/app/hooks
+ - ./layouts/:/app/layouts
+ - ./lib/:/app/lib
+ - ./pages/:/app/pages
+ - ./public/:/app/public
+ - ./scripts/:/app/scripts
+ - ./server/:/app/server
+ - ./styles/:/app/styles
+ - ./views/:/app/views
+ - ./events.json:/app/events.json
+ - ./next.config.js:/app/next.config.js
+ - ./.babelrc:/app/.babelrc
ports:
- - "${PORT:-3000}:${PORT:-3000}"
+ - "${PORT:-3000}:3000"
+ environment:
+ - NEXT_PUBLIC_ADRESSE_URL=${NEXT_PUBLIC_ADRESSE_URL}
+ - NEXT_PUBLIC_API_GEO_URL=${NEXT_PUBLIC_API_GEO_URL}
+ - NEXT_PUBLIC_API_BAN_URL=${NEXT_PUBLIC_API_BAN_URL}
+ - NEXT_PUBLIC_API_ADRESSE=${NEXT_PUBLIC_API_ADRESSE}
+ - NEXT_PUBLIC_API_ETABLISSEMENTS_PUBLIC=${NEXT_PUBLIC_API_ETABLISSEMENTS_PUBLIC}
+ - NEXT_PUBLIC_MATOMO_URL=${NEXT_PUBLIC_MATOMO_URL}
+ - NEXT_PUBLIC_MATOMO_SITE_ID=${NEXT_PUBLIC_MATOMO_SITE_ID}
+ - MATOMO_TOKEN_AUTH=${MATOMO_TOKEN_AUTH}
+ - ENABLE_HELMET=${ENABLE_HELMET}
+ - NEXT_PUBLIC_API_DEPOT_URL=${NEXT_PUBLIC_API_DEPOT_URL}
+ - API_DEPOT_TOKEN=${API_DEPOT_TOKEN}
+ - SESSION_SECRET=${SESSION_SECRET}
+ - NEXT_PUBLIC_CERTIFICAT_NUMEROTATION_ENABLED=${NEXT_PUBLIC_CERTIFICAT_NUMEROTATION_ENABLED}
+ - PATH_STATIC_FILE=${PATH_STATIC_FILE}
+ - GHOST_KEY=${GHOST_KEY}
+ - NEXT_PUBLIC_GHOST_URL=${NEXT_PUBLIC_GHOST_URL}
+ - NEXT_PUBLIC_GHOST_URL_IMAGES_SOURCE=${NEXT_PUBLIC_GHOST_URL_IMAGES_SOURCE}
+ - NEXT_PUBLIC_BAL_ADMIN_API_URL=${NEXT_PUBLIC_BAL_ADMIN_API_URL}
+ - NEXT_PUBLIC_BAL_API_URL=${NEXT_PUBLIC_BAL_API_URL}
+ - NEXT_PUBLIC_MES_ADRESSES=${NEXT_PUBLIC_MES_ADRESSES}
From 030beece8d924169767f8eef19fa15aa1280892c Mon Sep 17 00:00:00 2001
From: antoineludeau <52679050+antoineludeau@users.noreply.github.com>
Date: Thu, 11 Jan 2024 16:34:42 +0100
Subject: [PATCH 2/3] Fixed hard coded api ban url value
---
components/maplibre/ban-map/index.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/components/maplibre/ban-map/index.js b/components/maplibre/ban-map/index.js
index 6b183944d..c935a6387 100644
--- a/components/maplibre/ban-map/index.js
+++ b/components/maplibre/ban-map/index.js
@@ -31,6 +31,8 @@ import {flatten, forEach} from 'lodash'
import DeviceContext from '@/contexts/device'
import {Layer, Source, useMap, Popup} from 'react-map-gl/maplibre'
+const API_BAN_URL = process.env.NEXT_PUBLIC_API_BAN_URL || 'https://plateforme.adresse.data.gouv.fr'
+
let hoveredFeature = null
const SOURCES = ['adresses', 'toponymes']
@@ -322,7 +324,7 @@ function BanMap({address, bbox, onSelect, isMobile}) {
type='vector'
format='pbf'
tiles={[
- 'https://plateforme.adresse.data.gouv.fr/tiles/ban/{z}/{x}/{y}.pbf'
+ `${API_BAN_URL}/tiles/ban/{z}/{x}/{y}.pbf`
]}
minzoom={10}
maxzoom={14}
From 558c72ee4810b071b1ab769d332df93df9b2a5b2 Mon Sep 17 00:00:00 2001
From: antoineludeau <52679050+antoineludeau@users.noreply.github.com>
Date: Fri, 12 Jan 2024 15:56:35 +0100
Subject: [PATCH 3/3] Improved stats independence
---
components/bases-locales/index.js | 8 ++++---
lib/api-ban.js | 38 ++++++++++++++++++-------------
pages/index.js | 5 ++--
pages/programme-bal.js | 14 ++++++++----
4 files changed, 40 insertions(+), 25 deletions(-)
diff --git a/components/bases-locales/index.js b/components/bases-locales/index.js
index 3a2ccf13f..5e74d6400 100644
--- a/components/bases-locales/index.js
+++ b/components/bases-locales/index.js
@@ -111,9 +111,11 @@ const BasesLocales = React.memo(({stats}) => {
-
+ {stats && (
+
+ )}