-
-
Notifications
You must be signed in to change notification settings - Fork 454
Docker config improvements #82
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
base: dev
Are you sure you want to change the base?
Changes from all commits
c37255b
6a95402
f6ef40d
feecd3f
867ce24
d8f07fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| DATABASE_URL=mysql://admin:admin@db:3306/fastapi-admin | ||
| REDIS_URL=redis://redis:6379/0 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,9 @@ | ||
| FROM jfloff/alpine-python | ||
| ENV CRYPTOGRAPHY_DONT_BUILD_RUST=1 | ||
| RUN mkdir -p /fastapi-admin | ||
| WORKDIR /fastapi-admin | ||
| COPY pyproject.toml poetry.lock /fastapi-admin/ | ||
| RUN pip3 install poetry | ||
| ENV POETRY_VIRTUALENVS_CREATE false | ||
| WORKDIR /tmp | ||
| ADD pyproject.toml . | ||
| ADD poetry.lock . | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. simple oneline copy is sufficient (adds not needed) |
||
| RUN poetry install --no-root | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can remove also we can add |
||
| COPY . /fastapi-admin | ||
| RUN poetry install | ||
| RUN make compile | ||
| WORKDIR /fastapi-admin | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,15 +44,8 @@ Or pro version online demo [here](https://fastapi-admin-pro.long2ice.io/admin/lo | |
| ## Run examples in local | ||
|
|
||
| 1. Clone repo. | ||
| 2. Create `.env` file. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
|
||
| ```dotenv | ||
| DATABASE_URL=mysql://root:123456@127.0.0.1:3306/fastapi-admin | ||
| REDIS_URL=redis://localhost:6379/0 | ||
| ``` | ||
|
|
||
| 3. Run `docker-compose up -d --build`. | ||
| 4. Visit <http://localhost:8000/admin/init> to create first admin. | ||
| 2. Run `docker-compose up -d --build`. | ||
| 3. Visit <http://localhost:8000/admin/init> to create first admin. | ||
|
|
||
| ## Documentation | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,32 @@ services: | |
| build: . | ||
| restart: always | ||
| env_file: .env | ||
| network_mode: host | ||
| image: fastapi-admin | ||
| command: uvicorn examples.main:app_ --port 8000 --host 0.0.0.0 | ||
| command: bash -c "pybabel compile -d fastapi_admin/locales && uvicorn examples.main:app_ --port 8000 --host 0.0.0.0 --reload" | ||
| depends_on: | ||
| - db | ||
| - redis | ||
| volumes: | ||
| - .:/fastapi-admin | ||
| ports: | ||
| - 8000:8000 | ||
|
|
||
| db: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in db instead of environment section: suggestion: |
||
| image: mysql:5.7 | ||
| volumes: | ||
| - db_data:/var/lib/mysql | ||
| restart: always | ||
| environment: | ||
| MYSQL_ROOT_PASSWORD: 123456 | ||
| MYSQL_DATABASE: fastapi-admin | ||
| MYSQL_USER: admin | ||
| MYSQL_PASSWORD: admin | ||
|
|
||
| redis: | ||
| image: 'redis:6.2.5-alpine' | ||
| volumes: | ||
| - redis_data:/data | ||
|
|
||
| volumes: | ||
| db_data: | ||
| redis_data: | ||
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.
imo this file is not needed (look its ignored in gitignore)
i would create
.sample.envfile with given default values 🤔