From 6d3f1cb24feb5d570b213272e6fabd61d67989b5 Mon Sep 17 00:00:00 2001 From: long2ice Date: Mon, 17 Aug 2020 18:40:54 +0800 Subject: [PATCH] add Dockerfile --- Dockerfile | 9 +++++++++ docker-compose.yml | 18 ++++++++++++++++++ examples/Dockerfile | 9 --------- examples/docker-compose.yml | 0 4 files changed, 27 insertions(+), 9 deletions(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml delete mode 100644 examples/Dockerfile delete mode 100644 examples/docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..12c8c8a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM python:3 +RUN mkdir -p /fastapi-admin +WORKDIR /fastapi-admin +COPY pyproject.toml poetry.lock /fastapi-admin/ +RUN pip3 install poetry +ENV POETRY_VIRTUALENVS_CREATE false +RUN poetry install +COPY . /fastapi-admin +RUN poetry install diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..6a27c73 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +version: '3' +services: + mysql: + image: mariadb + environment: + MYSQL_ROOT_PASSWORD: 123456 + healthcheck: + test: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 10 + api: + build: . + environment: + DATABASE_URL: mysql://root:123456@mysql:3306/fastapi-admin + ports: + - '8000:8000' + depends_on: + - mysql + image: prismspay + command: uvicorn examples.main:app --port 8000 --host 0.0.0.0 diff --git a/examples/Dockerfile b/examples/Dockerfile deleted file mode 100644 index 8d97650..0000000 --- a/examples/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM python:3 -RUN mkdir -p /src -WORKDIR /src -COPY ../pyproject.toml ../poetry.lock /src/ -RUN pip3 install poetry -ENV POETRY_VIRTUALENVS_CREATE false -RUN poetry install --no-root -COPY . /src - diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml deleted file mode 100644 index e69de29..0000000