Skip to content

Commit

Permalink
[WIP] Working on integrating a developpement mode to the project. For…
Browse files Browse the repository at this point in the history
… the moment it only update the backend code live while coding. See #47.
  • Loading branch information
Christophe-Ramet committed Jan 10, 2025
1 parent d8d8738 commit 89d58ef
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 8 deletions.
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
SHELL := /bin/bash

prod:
docker compose up -d

submodule_init:
git submodule init
git submodule update
pushd sources/GeoNature &&\
git submodule init &&\
git submodule update &&\
popd

dev: submodule_init
build/build.sh
docker compose -f docker-compose.yml -f docker-compose-dev.yml up -d
10 changes: 4 additions & 6 deletions build/build.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
#!/bin/bash

set -x
set -x
set -o nounset

export COMPOSE_DOCKER_CLI_BUILD=1
export DOCKER_BUILDKIT=1

source .env

# GN BACKEND WHEELS
docker build -f sources/GeoNature/backend/Dockerfile -t ${GEONATURE_BACKEND_IMAGE}-wheels --target=wheels sources/GeoNature/

# GN BACKEND EXTRA
docker build \
--build-arg GEONATURE_BACKEND_IMAGE=${GEONATURE_BACKEND_IMAGE} \
-f ./build/Dockerfile-geonature-backend \
-t ${GEONATURE_BACKEND_EXTRA_IMAGE} .
--build-arg GEONATURE_BACKEND_IMAGE=${GEONATURE_BACKEND_IMAGE} \
-f ./build/Dockerfile-geonature-backend \
-t ${GEONATURE_BACKEND_EXTRA_IMAGE} .

# GN FRONTEND SOURCE
docker build -f sources/GeoNature/frontend/Dockerfile -t ${GEONATURE_FRONTEND_IMAGE}-source --target=source sources/GeoNature/
Expand Down
44 changes: 44 additions & 0 deletions build/dev/Dockerfile-geonature-backend
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
ARG GEONATURE_BACKEND_IMAGE="ghcr.io/pnx-si/geonature-backend-local:latest"

FROM python:3.11-bookworm AS build

ENV PIP_ROOT_USER_ACTION=ignore
RUN --mount=type=cache,target=/root/.cache \
pip install --upgrade pip setuptools wheel


FROM build AS build-export
WORKDIR /build/
COPY ./sources/gn_module_export .
RUN python setup.py bdist_wheel

FROM build AS build-dashboard
WORKDIR /build/
COPY ./sources/gn_module_dashboard .
RUN python setup.py bdist_wheel

FROM build AS build-monitoring
WORKDIR /build/
COPY ./sources/gn_module_monitoring .
RUN python setup.py bdist_wheel

FROM ${GEONATURE_BACKEND_IMAGE}-wheels AS dev


WORKDIR /dist/geonature
RUN --mount=type=cache,target=/var/cache/apt \
--mount=type=cache,target=/var/lib/apt \
apt-get update && apt-get install -y libproj-dev proj-bin
COPY --from=build-export /build/dist/*.whl .
COPY --from=build-dashboard /build/dist/*.whl .
COPY --from=build-monitoring /build/dist/*.whl .
RUN rm -f geonature-*
COPY --chown=${UID}:${GUID} /sources/GeoNature /sources/GeoNature
RUN --mount=type=cache,target=/root/.cache \
pip install -e /sources/GeoNature
RUN --mount=type=cache,target=/root/.cache \
pip install *.whl sentry_sdk[flask]
RUN rm -f *.whl



4 changes: 4 additions & 0 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
services:
geonature-backend:
volumes:
- ./sources/GeoNature:/sources/GeoNature
4 changes: 2 additions & 2 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ docker image inspect ghcr.io/pnx-si/geonature-backend-extra --format '{{json .Co

- Initialiser et cloner les sous-modules git :
```bash
git submodule init
git submodule update
git submodule update --init --recursive
git submodule update --recursive
```
- Faire de même pour les sous-modules de GeoNature et UsersHub, exemple pour GeoNature :
```bash
Expand Down

0 comments on commit 89d58ef

Please sign in to comment.