-
Notifications
You must be signed in to change notification settings - Fork 29
/
Dockerfile
59 lines (45 loc) · 2.01 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
FROM python:3.9
ARG BUILD_ENV=dev
ARG CHROMEDRIVER_VERSION
RUN mkdir -p /app/.apt/usr/bin
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#using-pipes
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Set up the Chrome PPA
# Update the package list and install chrome
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> \
/etc/apt/sources.list.d/google.list \
&& apt-get update -y \
&& apt-get install --no-install-recommends -y \
google-chrome-stable \
jq \
&& rm -rf /var/lib/apt/lists/*
COPY ./docker/utility/wrap_chrome_binary.sh /app/docker/utility/wrap_chrome_binary.sh
RUN /app/docker/utility/wrap_chrome_binary.sh
RUN ln -fs /usr/bin/google-chrome /usr/bin/chrome
# Set up Chromedriver Environment variables
ENV CHROMEDRIVER_DIR /chromedriver
RUN mkdir $CHROMEDRIVER_DIR
# Download and install Chromedriver
COPY ./docker/utility/install_chromedriver.sh /app/docker/utility/install_chromedriver.sh
RUN /app/docker/utility/install_chromedriver.sh $CHROMEDRIVER_DIR $CHROMEDRIVER_VERSION
# Update PATH
ENV PATH $CHROMEDRIVER_DIR:$PATH:/app/sfdx/bin
WORKDIR /app
# installing sfdx
COPY ./docker/utility/install_sfdx.sh ./docker/utility/install_sfdx.sh
RUN /bin/sh /app/docker/utility/install_sfdx.sh
# installing python related dependencies with pip
COPY ./requirements ./requirements
RUN pip install --no-cache-dir --upgrade pip pip-tools
RUN pip install --no-cache-dir -r /app/requirements/prod.txt
RUN if [ "${BUILD_ENV}" = "dev" ]; then pip install --no-cache-dir -r /app/requirements/dev.txt; fi
# copying rest of working directory to /app folder
COPY . /app
ENV DJANGO_HASHID_SALT='sample hashid=salt' \
DJANGO_SETTINGS_MODULE=config.settings.$BUILD_ENV \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
REDIS_URL="redis://redis:6379"
# Avoid building prod assets in development
RUN if [ "${BUILD_ENV}" = "production" ]; then python /app/manage.py collectstatic --noinput; fi