Skip to content
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

Docker Compose reorganized #437

Merged
merged 1 commit into from
Feb 26, 2024
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
1 change: 1 addition & 0 deletions .docker/database/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM mariadb:latest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd definitely use a specific version that is on prod. That's currently mysql-5.5, but find the oldest version you can and we'll keep them in sync once we upgrade :)

If there is a way to keep it in sync with the terraform version, that would be golden :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added version 10.0 that should be more or less compatible with mysql-5.5. For local developing mysql 5.5 and mariadb 5.5 do not have official docker images for arm64v8, do they? At least for it is this error:

image

13 changes: 13 additions & 0 deletions .docker/web/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM python:3.8

ENV PYTHONUNBUFFERED 1

RUN mkdir /code
WORKDIR /code

RUN pip install --upgrade pip

ADD requirements.txt .
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we going to be keeping this and top-level requirements in sync? Wouldn't it be better to just add the top-level one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seemed to me that the context specified in docker compose yaml file does not let us to load the root lvl requirements. It always gave me an error. I tried it now to be sure and now it works with ADD ./../../requirements.txt, so it seems we can use both.

Which file is better to keep? If we would use only docker, I'd say let's use this one. But we have also possibility to run the app without docker, right? Therefore it would be bad if it were only in docker directory, so I'd keep the root file and this could go away. What do you think?

RUN apt update \
&& apt install -y memcached libmemcached-dev \
&& pip install -r requirements.txt
15 changes: 15 additions & 0 deletions .docker/web/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Django>=2.0.0,<2.1
mysqlclient>=1.3.7,<1.4
gunicorn
sqlparse
argon2-cffi
bcrypt
pytz
pyyaml
sentry-sdk>=0.14.1
selenium
whitenoise
django-storages<1.10
boto3
django-bmemcached
python-binary-memcached
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
__pycache__
/.cache
/.db
.db-data

/docs/_build/

Expand All @@ -16,8 +17,8 @@ __pycache__
.DS_store

# Local building tools
/docker-compose.yml
docker-compose.yml

## Local IDEs dirs
.idea
/.idea
/.vscode
7 changes: 0 additions & 7 deletions Dockerfile

This file was deleted.

41 changes: 24 additions & 17 deletions docker-compose.example.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
version: '3'
version: '3.9'

services:

services:
db:
image: mysql:5.5
volumes:
- .db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=docker
- MYSQL_DATABASE=dracidoupe_cz
web:
build: .
command: python3 manage.py runserver 0.0.0.0:8000
build:
context: .docker/web
dockerfile: Dockerfile
depends_on:
- db
volumes:
- .:/code
ports:
- "8000:8000"
- "32768-65535"
depends_on:
- db
command: /bin/bash -c "python3 manage.py runserver 0.0.0.0:8000"

db:
build:
context: .docker/database
dockerfile: Dockerfile
volumes:
- .docker/database/.db-data:/var/lib/mysql
environment:
- MARIADB_ROOT_PASSWORD=docker
- MARIADB_DATABASE=dracidoupe_cz

adminer:
image: adminer
links:
- db
ports:
- 81:80
- "8080:8080"
depends_on:
- db

7 changes: 6 additions & 1 deletion docker-compose.server_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ version: '3'
# See https://circleci.com/docs/2.0/executor-types/

services:

db:
image: mysql:5.5
environment:
Expand All @@ -13,8 +14,12 @@ services:
web:
environment:
- SERVER_CI=true
build: .
build:
context: .docker/web
dockerfile: Dockerfile
command: python3 manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
expose:
- "8000"
- "32768-65535"
Expand Down
25 changes: 0 additions & 25 deletions docker-compose.yml

This file was deleted.

Loading