Skip to content

Docker config improvements#82

Open
radiophysicist wants to merge 6 commits intofastapi-admin:devfrom
radiophysicist:docker-config-improvements
Open

Docker config improvements#82
radiophysicist wants to merge 6 commits intofastapi-admin:devfrom
radiophysicist:docker-config-improvements

Conversation

@radiophysicist
Copy link
Contributor

Updated configuration allows:

  • Install DB and redis with docker-compose in isolation from the host system
  • Mount fastapi-admin and example sources as volume (no image rebuild on src changes)
  • Autorestart the example application on source changes

@dagostinelli
Copy link

Voted up

laggron42 added a commit to Ballsdex-Team/fastapi-admin that referenced this pull request Jul 26, 2023
Copy link

@janas-adam janas-adam left a comment

Choose a reason for hiding this comment

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

guys, confirm if pr is still active
thanks

also conflicts should be resolved

WORKDIR /tmp
ADD pyproject.toml .
ADD poetry.lock .
RUN poetry install --no-root

Choose a reason for hiding this comment

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

we can remove ENV POETRY_VIRTUALENVS_CREATE false
and simply do:

...
RUN poetry config virtualenvs.create false
RUN poetry install --no-root

also we can add ENV PYTHONUNBUFFERED 1

ENV POETRY_VIRTUALENVS_CREATE false
WORKDIR /tmp
ADD pyproject.toml .
ADD poetry.lock .

Choose a reason for hiding this comment

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

simple oneline copy is sufficient (adds not needed)

COPY pyproject.toml poetry.lock ./

@@ -0,0 +1,2 @@
DATABASE_URL=mysql://admin:admin@db:3306/fastapi-admin
REDIS_URL=redis://redis:6379/0

Choose a reason for hiding this comment

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

imo this file is not needed (look its ignored in gitignore)

i would create .sample.env file with given default values 🤔

## Run examples in local

1. Clone repo.
2. Create `.env` file.

Choose a reason for hiding this comment

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

then in readme we just inform

2. Copy sample env file and set your own environment variables
cp .sample.env .env

ports:
- 8000:8000

db:

Choose a reason for hiding this comment

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

in db instead of environment section:

  env_file: ./.env

suggestion:
i am wondering about creating additional docker-compose.dev.yaml file with db/redis service configuration 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants