From af618acf794ef8527477c86bc5b460cb481c5535 Mon Sep 17 00:00:00 2001 From: "Fergus MacConnell WLRS:EX" Date: Fri, 9 Aug 2024 15:43:20 -0700 Subject: [PATCH] Update dockerfile and docker compose file for backend and minio-pub services. --- backend/Dockerfile | 42 ++++++++++++++++++++++++++++-------------- docker-compose.yml | 14 ++++++++++++-- 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 07a3eac1b..781347e9c 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,8 +1,15 @@ -FROM python:3.7-slim AS build +FROM python:3.6.15-slim-buster AS build -RUN apt-get -y update && apt-get -y install git build-essential libgdal-dev && apt-get -y install apt-utils +RUN apt-get -y update && apt-get -y install \ + git \ + build-essential \ + gdal-bin \ + libgdal-dev -ENV PATH="/usr/bin/python3:${PATH}" +RUN echo "Checking gdal-config installation" +RUN find / -name gdal-config + +ENV PATH="/usr/bin:${PATH}" WORKDIR /app @@ -23,23 +30,30 @@ RUN python3 -m pip install -r requirements.txt # RUN chmod +x /backend/backend-command-script.sh # production image step -FROM python:3.7-slim +# FROM python:3.7-slim -# TODO: need to confirm version of libgdal-dev used with FROM python version -RUN apt-get -y update && \ - apt-get -y install libgdal32 +# # TODO: need to confirm version of libgdal-dev used with FROM python version +# RUN apt-get -y update && \ +# apt-get -y install libgdal32 \ +# gdal-bin -ENV PATH="/usr/bin/python3:${PATH}" +# ENV PATH="/usr/bin/python3:${PATH}" -WORKDIR /app +# WORKDIR /app -COPY --from=build /app /app -COPY --from=build /backend-command-script.sh /backend-command-script.sh -COPY --from=build /requirements.txt /requirements.txt +# RUN python3 -m pip install 'setuptools<58.0' +# RUN python3 -m pip install --upgrade pip +# RUN python3 -m pip install ptvsd -RUN chmod +x /app +# COPY --from=build /app /app +# COPY --from=build /backend-command-script.sh /backend-command-script.sh +# COPY --from=build /requirements.txt /requirements.txt + +# RUN chmod +x /app + +# RUN python3 -m pip install -r requirements.txt # make script executable # RUN chmod +x /backend/backend-command-script.sh -CMD ["/backend-command-script.sh"] \ No newline at end of file +# CMD ["python3", "manage.py", "runserver", "0.0.0.0:8000"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index f9d9f4c50..b4eb95311 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,7 +13,7 @@ services: ############################################################################################# minio-public: build: - context: ./openshift/docker/minio/ + context: ./gwells/openshift/docker/minio/ hostname: minio ports: - "9000:9000" @@ -140,7 +140,7 @@ services: ############################################################################################# backend: platform: linux/x86_64 - working_dir: /app/backend + working_dir: /app build: context: ./backend dockerfile: Dockerfile @@ -196,6 +196,16 @@ services: GEOCODER_ADDRESS_API_BASE: https://geocoder.api.gov.bc.ca/addresses.json? LOCAL: True LOAD_FIXTURES: True + command: /bin/bash -c " + python3 -m pip install --upgrade pip && + python3 -m pip install ptvsd && + python3 -m pip install -r requirements.txt && + python3 manage.py migrate --noinput && + ./load_fixtures.sh all && + python3 manage.py createinitialrevisions && + python3 manage.py collectstatic --noinput && + python3 manage.py export --cleanup=1 --upload=1 && + python3 manage.py runserver 0.0.0.0:8000" # volumes: # - type: bind # source: ./backend