Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,16 @@
.venv
__pycache__
pydis_site/apps/admin/tests
pydis_site/apps/admin/tests.py
pydis_site/apps/api/tests
pydis_site/apps/api/tests.py
pydis_site/apps/home/tests
pydis_site/apps/home/tests.py
pydis_site/apps/staff/tests
pydis_site/apps/staff/tests.py
CHANGELOG.md
CONTRIBUTING.md
docker
!docker/app/scripts/migrate_and_boot.sh
!docker/app/scripts/migrate.sh
!docker/app/uwsgi.ini
!docker/app/wheels
docker-compose.yml
Dockerfile
Dockerfile.local
docs
htmlcov
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,7 @@ media/
pip-wheel-metadata/
staticfiles/

!docker/app/wheels

*.js.tmp
log.*
3 changes: 2 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ django-crispy-bulma = ">=0.1.2,<2.0"
whitenoise = "==4.1.2"
requests = "~=2.21"
pygments = "~=2.3.1"
wiki = {git = "https://github.com/python-discord/django-wiki.git"}
#wiki = {git = "https://github.com/python-discord/django-wiki.git"}
wiki = {path = "./docker/app/wheels/wiki-0.5.dev20190420204942-py3-none-any.whl"}
pyyaml = "*"

[requires]
Expand Down
150 changes: 122 additions & 28 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 9 additions & 11 deletions docker/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
FROM bitnami/python:3.7-prod
FROM python:3.7-slim

# I have no idea what this does.
# Allow service to handle stops gracefully
STOPSIGNAL SIGQUIT

# Set pip to have cleaner logs and no saved cache
ENV PIP_NO_CACHE_DIR=false \
PIPENV_HIDE_EMOJIS=1 \
PIPENV_NOSPIN=1

# Create a user.
# Create non-root user.
RUN useradd --system --shell /bin/false --uid 1500 pysite

# Install prerequisites needed to complete the dependency installation.
RUN install_packages git gcc libc-dev libpq-dev
# Install pipenv & pyuwsgi
RUN pip install -U pipenv pyuwsgi

# Copy the project files into the working directory.
# Copy the project files into working directory
WORKDIR /app
COPY . .

# Update setuptools by removing egg first, add other dependencies
RUN rm -r /opt/bitnami/python/lib/python3.*/site-packages/setuptools* && \
pip install -U setuptools
RUN pip install pipenv uwsgi
# Install project dependencies
RUN pipenv install --system --deploy

# Migrate, collect and start the app.
# Migrate, collect and start the app
RUN chmod +x /app/docker/app/scripts/migrate.sh
ENTRYPOINT ["/app/docker/app/scripts/migrate.sh"]
CMD ["uwsgi", "--ini", "docker/app/uwsgi.ini"]
2 changes: 2 additions & 0 deletions docker/app/build-wiki.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM python:3.7
RUN pip --no-cache-dir wheel --wheel-dir=/wheels "wiki @ git+https://github.com/python-discord/django-wiki.git"
21 changes: 11 additions & 10 deletions docker/app/local.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
FROM bitnami/python:3.7-prod
FROM python:3.7-slim

# Allow service to handle stops gracefully
STOPSIGNAL SIGQUIT

# Set pip to have cleaner logs and no saved cache
ENV PIP_NO_CACHE_DIR=false \
PIPENV_HIDE_EMOJIS=1 \
PIPENV_NOSPIN=1

# Create a user.
# Create non-root user
RUN useradd --system --shell /bin/false --uid 1500 pysite

# Install prerequisites needed to complete the dependency installation.
RUN install_packages git gcc libc-dev libpq-dev
# Install pipenv & pyuwsgi
RUN pip install -U pipenv pyuwsgi

# Copy the project files into the working directory.
# Copy the project files into working directory
WORKDIR /app
COPY . .

# Update setuptools by removing egg first, add other dependencies
RUN rm -r /opt/bitnami/python/lib/python3.*/site-packages/setuptools* && \
pip install -U setuptools
RUN pip install pipenv uwsgi
# Install project dependencies
RUN pipenv install --system --deploy

RUN SECRET_KEY=placeholder DATABASE_URL=sqlite:// python3 manage.py collectstatic --no-input --clear --verbosity 0
# Prepare static files for site
RUN SECRET_KEY=placeholder DATABASE_URL=sqlite:// \
python3 manage.py collectstatic --no-input --clear --verbosity 0

CMD ["uwsgi", "--ini", "docker/app/uwsgi.ini"]
4 changes: 4 additions & 0 deletions docker/app/scripts/build-wiki.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
docker build -t build_uwsgi -f docker/app/build-wiki.Dockerfile .
CONTAINER=$(docker run -itd build_uwsgi /bin/bash)
docker cp "$CONTAINER:/wheels" docker/app
docker stop "$CONTAINER"
Binary file not shown.