<commit_before>FROM python:3.6

WORKDIR /usr/src/app

ADD requirements.txt /usr/src/app

RUN pip install --upgrade pip \
	&& pip install --no-cache-dir -r /usr/src/app/requirements.txt

# Only add what is needed
ADD templates /usr/src/templates

# Leaving this lower in the layers for CI, don't install the packages again
# CI will build both PostgreSQL and MySQL
ARG PROJECT
ARG DATABASE_TYPE

ENV PROJECT ${PROJECT}
ENV DATABASE_TYPE ${DATABASE_TYPE}

RUN mkdir /tmp/build \
	&& django-admin startproject ${PROJECT} /tmp/build 

ADD templates/Makefile /tmp/build/Makefile
ADD templates/requirements.txt /tmp/build/requirements.txt
ADD templates/nginx /tmp/build/nginx
ADD templates/Dockerfile /tmp/build/Dockerfile
ADD templates/docker-compose-dev.yml /tmp/build/docker-compose-dev.yml

# If you set the destination directory manage.py complain that it doesn't exist
# If you create the destination directory manage.py complains it's a duplicate
# *eye roll*
WORKDIR /tmp/build
RUN python manage.py startapp homepage
# 	&& printf "PROJECT = $PROJECT\n\n" > Makefile \
# 	&& cat /usr/src/templates/Makefile >> Makefile

# MySQL setup
RUN if [ "$DATABASE_TYPE" = "mysql" ]; then \
	cat /usr/src/templates/docker-compose.yml /usr/src/templates/docker-compose-part-mysql.yml > /tmp/build/docker-compose.yml; \
	fi

# PostgreSQL setup
RUN if [ "$DATABASE_TYPE" = "postgres" ]; then cat /usr/src/templates/docker-compose.yml /usr/src/templates/docker-compose-part-postgres.yml > /tmp/build/docker-compose.yml; fi

RUN cp /usr/src/templates/settings.py /tmp/build/${PROJECT} \
	&& printf "\n\nROOT_URLCONF = '${PROJECT}.urls'\n" >> /tmp/build/${PROJECT}/settings.py \
	&& printf "WSGI_APPLICATION = '${PROJECT}.wsgi.application'\n" >> /tmp/build/${PROJECT}/settings.py \
	&& printf "SECRET_KEY = '$(openssl rand  -base64 40)'\n" >> /tmp/build/${PROJECT}/settings.py

CMD ["bash"]<commit_msg>[fixed] Put SECRET_KEY in correct file<commit_after>FROM python:3.6

WORKDIR /usr/src/app

ADD requirements.txt /usr/src/app

RUN pip install --upgrade pip \
	&& pip install --no-cache-dir -r /usr/src/app/requirements.txt

# Only add what is needed
ADD templates /usr/src/templates

# Leaving this lower in the layers for CI, don't install the packages again
# CI will build both PostgreSQL and MySQL
ARG PROJECT
ARG DATABASE_TYPE

ENV PROJECT ${PROJECT}
ENV DATABASE_TYPE ${DATABASE_TYPE}

RUN mkdir /tmp/build \
	&& django-admin startproject ${PROJECT} /tmp/build 

ADD templates/Makefile /tmp/build/Makefile
ADD templates/requirements.txt /tmp/build/requirements.txt
ADD templates/nginx /tmp/build/nginx
ADD templates/Dockerfile /tmp/build/Dockerfile
ADD templates/docker-compose-dev.yml /tmp/build/docker-compose-dev.yml

# If you set the destination directory manage.py complain that it doesn't exist
# If you create the destination directory manage.py complains it's a duplicate
# *eye roll*
WORKDIR /tmp/build
RUN python manage.py startapp homepage
# 	&& printf "PROJECT = $PROJECT\n\n" > Makefile \
# 	&& cat /usr/src/templates/Makefile >> Makefile

# MySQL setup
RUN if [ "$DATABASE_TYPE" = "mysql" ]; then \
	cat /usr/src/templates/docker-compose.yml /usr/src/templates/docker-compose-part-mysql.yml > /tmp/build/docker-compose.yml; \
	fi

# PostgreSQL setup
RUN if [ "$DATABASE_TYPE" = "postgres" ]; then cat /usr/src/templates/docker-compose.yml /usr/src/templates/docker-compose-part-postgres.yml > /tmp/build/docker-compose.yml; fi

RUN cp /usr/src/templates/settings.py /tmp/build/${PROJECT} \
	&& cp /usr/src/templates/env_${DATABASE_TYPE} /tmp/build/.env \
	&& printf "\n\nROOT_URLCONF = '${PROJECT}.urls'\n" >> /tmp/build/${PROJECT}/settings.py \
	&& printf "WSGI_APPLICATION = '${PROJECT}.wsgi.application'\n\n" >> /tmp/build/${PROJECT}/settings.py \
	&& printf "SECRET_KEY=$(openssl rand  -base64 40)\n\n" >> /tmp/build/.env

CMD ["bash"]
{'fraction_non_alphanumeric': 0.13995837669094693, 'fraction_numerical': 0.003121748178980229, 'mean_word_length': 4.045931758530184, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4344977', 'n_tokens_mistral': 1381, 'n_tokens_neox': 1314, 'n_words': 328}