Skip to content

Commit

Permalink
fix: install wget in runtime container
Browse files Browse the repository at this point in the history
  • Loading branch information
ngurenyaga committed Jul 12, 2021
1 parent 59f6382 commit 59ad482
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 95 deletions.
4 changes: 0 additions & 4 deletions .envs/.local/.django

This file was deleted.

7 changes: 0 additions & 7 deletions .envs/.local/.postgres

This file was deleted.

5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -324,15 +324,12 @@ tags
### Project template

pepfar_mle/media/

.pytest_cache/


.ipython/
.env
.envs/*
!.envs/.local/

local.sh
secrets/*
cloud_sql_proxy

10 changes: 9 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ARG BUILD_ENVIRONMENT=production
# Install apt packages
RUN apt-get update && apt-get install --no-install-recommends -y \
# dependencies for building Python packages
build-essential \
build-essential wget \
# psycopg2 dependencies
libpq-dev

Expand Down Expand Up @@ -55,6 +55,8 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
libpq-dev \
# Translations dependencies
gettext \
# wget
wget \
# cleaning up unused files
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*
Expand All @@ -78,4 +80,10 @@ COPY --from=client-builder --chown=django:django ${APP_HOME} ${APP_HOME}
# make django owner of the WORKDIR directory as well.
RUN chown django:django ${APP_HOME}
USER django

# set up cloud SQL proxy
ENV CLOUD_SQL_PROXY_VERSION v1.23.0
RUN wget "https://storage.googleapis.com/cloudsql-proxy/${CLOUD_SQL_PROXY_VERSION}/cloud_sql_proxy.linux.amd64" -O /cloud_sql_proxy
RUN chmod +x /cloud_sql_proxy

ENTRYPOINT ["/entrypoint"]
11 changes: 3 additions & 8 deletions entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,9 @@ set -o errexit
set -o pipefail
set -o nounset

# set up Cloud SQL proxy
if [ -z "${CLOUD_SQL_PROXY_VERSION}" ]; then
export CLOUD_SQL_PROXY_VERSION=v1.23.0 # see https://github.com/GoogleCloudPlatform/cloudsql-proxy/releases
fi
wget "https://storage.googleapis.com/cloudsql-proxy/$CLOUD_SQL_PROXY_VERSION/cloud_sql_proxy.linux.amd64" -O cloud_sql_proxy
chmod +x cloud_sql_proxy
cloud_sql_proxy -verbose -structured_logs -dir=/cloudsql -instances=$INSTANCE_CONNECTION_NAME & # run in the background!
sleep 10 # allow time for the proxy to start
# run in the background and allow it some time to start before continuing
/cloud_sql_proxy -verbose -structured_logs -dir=/cloudsql -instances=$INSTANCE_CONNECTION_NAME &
sleep 10
echo "Created Cloud SQL Proxy at $INSTANCE_CONNECTION_NAME, running in the background"

if [ -z "${POSTGRES_USER}" ]; then
Expand Down
70 changes: 0 additions & 70 deletions merge_production_dotenvs_in_dotenv.py

This file was deleted.

2 changes: 1 addition & 1 deletion requirements/production.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PRECAUTION: avoid production dependencies that aren't in development

-r base.txt
-r local.txt

gunicorn~=20.1.0 # https://github.com/benoitc/gunicorn
psycopg2~=2.9.1 # https://github.com/psycopg/psycopg2
Expand Down

0 comments on commit 59ad482

Please sign in to comment.