Skip to content

Commit

Permalink
Update dockerfile and docker compose file for backend and minio-pub s…
Browse files Browse the repository at this point in the history
…ervices.
  • Loading branch information
fergmac committed Aug 9, 2024
1 parent 934161e commit af618ac
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 16 deletions.
42 changes: 28 additions & 14 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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"]
# CMD ["python3", "manage.py", "runserver", "0.0.0.0:8000"]
14 changes: 12 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
#############################################################################################
minio-public:
build:
context: ./openshift/docker/minio/
context: ./gwells/openshift/docker/minio/
hostname: minio
ports:
- "9000:9000"
Expand Down Expand Up @@ -140,7 +140,7 @@ services:
#############################################################################################
backend:
platform: linux/x86_64
working_dir: /app/backend
working_dir: /app
build:
context: ./backend
dockerfile: Dockerfile
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit af618ac

Please sign in to comment.