File: //home/arjun/projects/buyercall_forms/buyercall/Dockerfile.prod
# Use the barebones version of Python 2.7.10.
FROM python:3.8.19-bullseye
MAINTAINER Nick Janetakis <nick.janetakis@gmail.com>
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ $(grep -oP 'VERSION_CODENAME=\K\w+' /etc/os-release)-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7FCC7D46ACCC4CF8
# Install any packages that must be installed.
RUN apt-get update && apt-get install -qq -y curl build-essential libffi-dev libpq-dev \
libcairo2 libpango1.0-0 libpangocairo-1.0.0 \
postgresql-client-9.6 libpng-dev libjpeg-dev libxml2-dev libxslt1-dev libglu1\
--fix-missing --no-install-recommends
# Setup the install path for this service.
ENV INSTALL_PATH /buyercall
RUN mkdir -p $INSTALL_PATH
# Update the workdir to be where our app is installed.
WORKDIR $INSTALL_PATH
# Ensure packages are cached and only get updated when necessary.
COPY requirements.txt requirements.txt
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
# Ensure frontend packages are cached and only get updated when necessary.
# nvm environment variables
RUN mkdir -p /usr/local/nvm
ENV NVM_DIR /usr/local/nvm
ENV NODE_VERSION 12.22.6
# install nvm
# https://github.com/creationix/nvm#install-script
RUN curl --silent -o- https://raw.githubusercontent.com/creationix/nvm/v0.35.2/install.sh | bash
# install node and npm
RUN . $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default
# add node and npm to path so the commands are available
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
COPY package.json package.json
RUN npm install --production --unsafe-perm
ENV SERVER_NAME HTTP_HOST_HERE
ENV PUBLIC_PATH https://HTTP_HOST_HERE/
ENV URL_SCHEME https
# Copy the source from the build machine to the image at the WORKDIR path.
COPY build ./build
COPY config ./config
COPY buyercall/assets ./buyercall/assets
COPY buyercall/translations ./buyercall/translations
# Process all of the assets.
COPY . .
RUN npm run-script build
# Give access to the CLI script.
RUN pip install --editable .
# Create a volume so that nginx can read from it.
VOLUME ["$INSTALL_PATH/build/public"]
# The default command to run if no command is specified.
CMD gunicorn -b 0.0.0.0:8000 "buyercall.app:create_app()"