-
Notifications
You must be signed in to change notification settings - Fork 86
Add docker-compose file for local development. #567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
chriswedgwood
merged 1 commit into
django:main
from
Antoliny0919:add_local_docker_compose
Jun 28, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
SECRET_KEY=<####SECRET####> | ||
DEBUG=True | ||
ALLOWED_HOSTS=0.0.0.0,127.0.0.1,localhost | ||
DJANGO_SETTINGS_MODULE=djangosnippets.settings.development | ||
SEARCHBOX_SSL_URL=http://elasticsearch:9200/ | ||
SESSION_COOKIE_SECURE=False | ||
DATABASE_URL=postgres://djangosnippets:djangosnippets@db/djangosnippets | ||
POSTGRES_USER=djangosnippets | ||
POSTGRES_PASSWORD=djangosnippets | ||
POSTGRES_DB=djangosnippets | ||
REDISTOGO_URL=redis://redis:6379/0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
SECRET_KEY=<####SECRET####> | ||
DEBUG=True | ||
ALLOWED_HOSTS=0.0.0.0,127.0.0.1,localhost | ||
DJANGO_SETTINGS_MODULE=djangosnippets.settings.development | ||
SEARCHBOX_SSL_URL=http://elasticsearch:9200/ | ||
SESSION_COOKIE_SECURE=False | ||
DATABASE_URL=postgres://djangosnippets:djangosnippets@db/djangosnippets | ||
REDISTOGO_URL=redis://redis:6379/0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# define an alias for the specific python version used in this file. | ||
FROM docker.io/python:3.11-slim-bookworm AS python | ||
|
||
# Python build stage | ||
FROM python AS python-build-stage | ||
|
||
# Install apt packages | ||
RUN apt-get update && apt-get install --no-install-recommends -y \ | ||
# dependencies for building Python packages | ||
build-essential \ | ||
# psycopg dependencies | ||
libpq-dev | ||
|
||
# Requirements are installed here to ensure they will be cached. | ||
COPY ./requirements . | ||
|
||
# Create Python Dependency and Sub-Dependency Wheels. | ||
RUN pip wheel --wheel-dir /usr/src/app/wheels \ | ||
-r development.txt | ||
|
||
# Python 'run' stage | ||
FROM python AS python-run-stage | ||
|
||
ENV PYTHONUNBUFFERED=1 | ||
ENV PYTHONDONTWRITEBYTECODE=1 | ||
|
||
WORKDIR /app | ||
|
||
ARG NODE_MAJOR=20 | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y ca-certificates curl gnupg \ | ||
&& mkdir -p /etc/apt/keyrings \ | ||
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \ | ||
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \ | ||
&& apt-get update \ | ||
&& apt-get install nodejs -y \ | ||
&& rm -rf /var/lib/apt/lists/* /usr/share/doc /usr/share/man \ | ||
&& apt-get clean | ||
|
||
# devcontainer dependencies and utils | ||
RUN apt-get update && apt-get install --no-install-recommends -y \ | ||
sudo git bash-completion nano ssh | ||
|
||
# Create devcontainer user and add it to sudoers | ||
RUN groupadd --gid 1000 dev-user \ | ||
&& useradd --uid 1000 --gid dev-user --shell /bin/bash --create-home dev-user \ | ||
&& echo dev-user ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/dev-user \ | ||
&& chmod 0440 /etc/sudoers.d/dev-user | ||
|
||
# Install required system dependencies | ||
RUN apt-get update && apt-get install --no-install-recommends -y \ | ||
# psycopg dependencies | ||
libpq-dev \ | ||
wait-for-it \ | ||
# Translations dependencies | ||
gettext \ | ||
# cleaning up unused files | ||
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# All absolute dir copies ignore workdir instruction. All relative dir copies are wrt to the workdir instruction | ||
# copy python dependency wheels from python-build-stage | ||
COPY --from=python-build-stage /usr/src/app/wheels /wheels/ | ||
|
||
# use wheels to install python dependencies | ||
RUN pip install --no-cache-dir --no-index --find-links=/wheels/ /wheels/* \ | ||
&& rm -rf /wheels/ | ||
|
||
COPY ./compose/local/django/start /start | ||
RUN sed -i 's/\r$//g' /start | ||
RUN chmod +x /start | ||
|
||
CMD ["/start"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit | ||
set -o pipefail | ||
set -o nounset | ||
|
||
python manage.py migrate | ||
python manage.py tailwind install | ||
python manage.py runserver_plus 0.0.0.0:8000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left the tests in the existing production environment as they were.
This part will probably need improvement as well.