-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathDockerfile
More file actions
66 lines (52 loc) · 1.83 KB
/
Dockerfile
File metadata and controls
66 lines (52 loc) · 1.83 KB
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
60
61
62
63
64
65
66
# DESCRIPTION: Deploys GooglePhish in Container
# AUTHOR: Dhrumil Mistry <contact@dmdhrumilmistry.tech>
# COMMENTS:
# This file describes how to deploy GooglePhish
# in a container with all dependencies installed.
# USAGE:
# # Download googlephish Dockerfile
# wget [link]
#
# # Build image
# docker build -t googlephish .
#
# # run docker container
# docker run -d -p 80:8000 googlephish
#
# Use python slim as base image
FROM python:3.12-slim
# Set environment variables
ENV POETRY_HOME="/opt/poetry"
ENV PATH="$POETRY_HOME/bin:$PATH"
ENV GP_DIR="/GooglePhish"
# Set working directory
WORKDIR $GP_DIR
# Install system dependencies for Poetry and other build tools
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
build-essential \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
# Install Poetry
RUN curl -sSL https://install.python-poetry.org | python3 -
# Copy project files
COPY . .
# Install project dependencies with Poetry without creating virtualenv (use system python)
RUN poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi --no-root
# Check for errors in application
RUN poetry run python manage.py check
# Make migrations and migrate database
RUN poetry run python manage.py makemigrations
RUN poetry run python manage.py migrate
# Collect static files
RUN poetry run python manage.py collectstatic --noinput
# Set environment variables for superuser creation
ENV DJANGO_SUPERUSER_EMAIL=admin@mail.local
ENV DJANGO_SUPERUSER_USERNAME=admin
ENV DJANGO_SUPERUSER_PASSWORD=G00g13P#15#23
# Create superuser without input prompts
RUN poetry run python manage.py createsuperuser --noinput || echo "Superuser already exists."
# Expose port
EXPOSE 8000
# Start the application using gunicorn
CMD ["poetry", "run", "gunicorn", "GooglePhish.wsgi:application", "-b", "0.0.0.0:8000"]