Skip to content

Commit

Permalink
Add psql client to backend docker image.
Browse files Browse the repository at this point in the history
  • Loading branch information
fergmac committed Jan 3, 2025
1 parent 0872016 commit 3276ef4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 17 deletions.
7 changes: 5 additions & 2 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ RUN npm run build
FROM python:3.7

# Install dependencies
RUN apt -y update && apt -y install git build-essential gdal-bin libgdal-dev
RUN apt -y update && apt -y install git build-essential gdal-bin libgdal-dev postgresql-client

ENV PATH="/usr/bin/python3:${PATH}"

Expand All @@ -36,6 +36,7 @@ COPY ./backend/requirements.txt /app/requirements.txt

COPY --from=frontend ./app/dist ./gwells/static
COPY --from=frontend ./app/dist/index.html ./gwells/templates/
# COPY /backend/startup.sh /docker-entrypoint-initdb.d/

# RUN chmod +x load_fixtures.sh works when i pull the dockerfile into backend but not when dockerfile is with other docker files
RUN chmod +x /app
Expand All @@ -46,9 +47,11 @@ RUN python3 -m pip install -r requirements.txt

# TODO: move to entrypoint in deployment template?
# chmod -R 777 /app && \
# CMD [""]

CMD sh -c "python3 manage.py migrate --noinput && \

Check warning on line 52 in backend/Dockerfile

View workflow job for this annotation

GitHub Actions / Builds (backend)

JSON arguments recommended for ENTRYPOINT/CMD to prevent unintended behavior related to OS signals

JSONArgsRecommended: JSON arguments recommended for CMD to prevent unintended behavior related to OS signals More info: https://docs.docker.com/go/dockerfile/rule/json-args-recommended/
./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"
python3 manage.py runserver 0.0.0.0:8000"
28 changes: 13 additions & 15 deletions backend/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ objects:
- name: DATABASE_SERVICE_NAME
value: ${REPO}-${ZONE}-database
- name: DATABASE_PORT
value: 5432
value: "5432"
- name: DATABASE_NAME
valueFrom:
secretKeyRef:
Expand Down Expand Up @@ -461,24 +461,22 @@ objects:
memory: "${MEMORY_REQUEST}"
readinessProbe:
httpGet:
path: /gwells/health
path: /health
port: 8000
scheme: HTTP
initialDelaySeconds: 20
timeoutSeconds: 3
periodSeconds: 5
successThreshold: 1
failureThreshold: 5
# initialDelaySeconds: 20
# timeoutSeconds: 3
# periodSeconds: 5
# successThreshold: 1
# failureThreshold: 5
livenessProbe:
httpGet:
path: /gwells/health
path: /health
port: 8000
scheme: HTTP
initialDelaySeconds: 20
timeoutSeconds: 3
periodSeconds: 30
successThreshold: 1
failureThreshold: 5
# initialDelaySeconds: 20
# timeoutSeconds: 3
# periodSeconds: 30
# successThreshold: 1
# failureThreshold: 5
terminationMessagePath: "/dev/termination-log"
terminationMessagePolicy: File
imagePullPolicy: Always
Expand Down
6 changes: 6 additions & 0 deletions backend/startup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
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"

0 comments on commit 3276ef4

Please sign in to comment.