-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Feat/add dev compose #48
base: develop
Are you sure you want to change the base?
Changes from all commits
0b6e40d
6d82f28
a268d1e
a24a896
23f0461
55cc8e9
adf988a
3149c0d
91caef0
d8d8738
89d58ef
78cef23
3543de7
dc395e9
c0ca1b5
8f47ff4
a676d88
fcf3fce
44acddd
80a0e90
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
SHELL := /bin/bash | ||
|
||
launch: submodule_init | ||
docker compose up -d | ||
|
||
dev_init: | ||
jq '.projects.geonature.architect.build.configurations.development += {"baseHref": "/geonature/"}' sources/GeoNature/frontend/angular.json > angular.json.tmp && mv angular.json.tmp sources/GeoNature/frontend/angular.json # Pas une super pratique mais pas d'autre solution pour le moment | ||
|
||
submodule_init: | ||
git submodule update --init --recursive | ||
|
||
build: | ||
build/build.sh | ||
|
||
dev: dev_init | ||
COMPOSE_FILE=docker-compose.yml:docker-compose-dev.yml docker compose up -d | ||
|
||
prod: | ||
COMPOSE_FILE=docker-compose.yml docker compose up -d |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
ARG GEONATURE_BACKEND_IMAGE | ||
ARG GEONATURE_BACKEND_IMAGE="ghcr.io/pnx-si/geonature-backend-local:latest" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nécessaire ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ne pas remplir cette ligne créait des warnings au moment du build chez moi (quelque chose du genre There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On peut utiliser un |
||
|
||
FROM python:3.11-bookworm AS build | ||
|
||
|
@@ -22,15 +22,17 @@ WORKDIR /build/ | |
COPY ./sources/gn_module_monitoring . | ||
RUN python setup.py bdist_wheel | ||
|
||
FROM ${GEONATURE_BACKEND_IMAGE}-wheels AS prod-extra | ||
|
||
FROM ${GEONATURE_BACKEND_IMAGE}-wheels AS base_env | ||
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 . | ||
|
||
|
||
FROM base_env AS prod-extra | ||
RUN --mount=type=cache,target=/root/.cache \ | ||
pip install *.whl sentry_sdk[flask] | ||
RUN rm -f *.whl |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
ARG GEONATURE_BACKEND_IMAGE="ghcr.io/pnx-si/geonature-backend-local:latest" | ||
Christophe-Ramet marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
FROM ${GEONATURE_BACKEND_IMAGE}-wheels AS base_env | ||
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 | ||
|
||
RUN rm -f geonature-* | ||
COPY --chown=${UID}:${GUID} /sources/GeoNature /sources/GeoNature | ||
COPY --chown=${UID}:${GUID} /sources/gn_module_export /sources/gn_module_export | ||
COPY --chown=${UID}:${GUID} /sources/gn_module_dashboard /sources/gn_module_dashboard | ||
COPY --chown=${UID}:${GUID} /sources/gn_module_monitoring /sources/gn_module_monitoring | ||
RUN --mount=type=cache,target=/root/.cache \ | ||
pip install *.whl sentry_sdk[flask] | ||
RUN --mount=type=cache,target=/root/.cache \ | ||
pip install -e /sources/GeoNature -e /sources/gn_module_export -e /sources/gn_module_dashboard -e /sources/gn_module_monitoring | ||
RUN rm -f *.whl |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
services: | ||
|
||
#------------------------------------Builds section start-----------------------------------# | ||
base-backend: | ||
image: ${GEONATURE_BACKEND_IMAGE}-wheels | ||
build: | ||
context: sources/GeoNature | ||
dockerfile: backend/Dockerfile | ||
target: wheels | ||
entrypoint: /bin/bash -c exit | ||
|
||
base-frontend-source: | ||
image: ${GEONATURE_FRONTEND_IMAGE}-source | ||
build: | ||
context: sources/GeoNature | ||
dockerfile: frontend/Dockerfile | ||
target: source | ||
entrypoint: /bin/bash -c exit | ||
|
||
base-frontend-nginx: | ||
image: ${GEONATURE_FRONTEND_IMAGE}-nginx | ||
build: | ||
context: sources/GeoNature | ||
dockerfile: frontend/Dockerfile | ||
target: prod-base | ||
entrypoint: /bin/sh -c exit | ||
|
||
userhub-build: | ||
image: ${USERSHUB_IMAGE} | ||
build: | ||
target: prod | ||
context: sources/UsersHub | ||
volumes: | ||
- ./config/usershub:/dist/config/ | ||
entrypoint: /bin/sh -c exit | ||
#------------------------------------Builds section end------------------------------------# | ||
geonature-install-db: | ||
depends_on: | ||
base-backend: | ||
condition: service_completed_successfully | ||
build: | ||
dockerfile: build/dev/Dockerfile-geonature-backend | ||
|
||
geonature-backend: | ||
depends_on: | ||
base-backend: | ||
condition: service_completed_successfully | ||
volumes: | ||
- ./sources/GeoNature:/sources/GeoNature | ||
- ./sources/gn_module_export:/sources/gn_module_export | ||
- ./sources/gn_module_dashboard:/sources/gn_module_dashboard | ||
- ./sources/gn_module_monitoring:/sources/gn_module_monitoring | ||
build: | ||
dockerfile: build/dev/Dockerfile-geonature-backend | ||
|
||
geonature-worker: | ||
depends_on: | ||
base-backend: | ||
condition: service_completed_successfully | ||
volumes: | ||
- ./sources/GeoNature:/sources/GeoNature | ||
- ./sources/gn_module_export:/sources/gn_module_export | ||
- ./sources/gn_module_dashboard:/sources/gn_module_dashboard | ||
- ./sources/gn_module_monitoring:/sources/gn_module_monitoring | ||
build: | ||
dockerfile: build/dev/Dockerfile-geonature-backend | ||
|
||
|
||
traefik: | ||
command: | ||
- "--api.insecure=true" | ||
- "--providers.docker=true" | ||
- "--providers.docker.exposedbydefault=false" | ||
- "--entryPoints.web.address=:80" | ||
- "--entryPoints.web.http.redirections.entrypoint.to=:${HTTPS_PORT}" | ||
- "--entryPoints.web.http.redirections.entrypoint.scheme=https" | ||
- "--entryPoints.websecure.address=:443" | ||
- "--certificatesResolvers.acme-resolver.acme.email=${ACME_EMAIL}" | ||
- "--certificatesResolvers.acme-resolver.acme.storage=/etc/traefik/certs/acme.json" | ||
- "--certificatesResolvers.acme-resolver.acme.tlsChallenge=true" | ||
ports: | ||
- "8080:8080" | ||
|
||
geonature-frontend: | ||
depends_on: | ||
base-frontend-source: | ||
condition: service_completed_successfully | ||
command: npm run start -- --host 0.0.0.0 --port 4443 | ||
build: | ||
context: . | ||
dockerfile: build/Dockerfile-geonature-frontend | ||
target: dev-extra | ||
args: | ||
GEONATURE_FRONTEND_IMAGE: ${GEONATURE_FRONTEND_IMAGE} | ||
volumes: | ||
- ./sources/GeoNature/frontend:/build | ||
|
||
# TODO rendre optionel la partie peuplement de la BDD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.