Build a GraphQL environment using docker using Flask, a web framework of python.
Here, docker and docker-compose will be explained. Graphene settings are [Python (Flask) with GraphQL Server implementing SQLAlchemy, graphene, and SQLite](https://medium.com/swlh/python-flask-with-graphql-server-with-sqlalchemy-and-graphene-and See -sqlite-ac9fcc9d3d83)
.
├── docker-compose.yml
├── Dockerfile
├── requirements.txt
├── books/← Refer to the above site
requirements.txt
requirements.txt
Flask==1.1.2
Flask-GraphQL==2.0.1
graphene==2.1.8
graphene-sqlalchemy==2.3.0.dev1
SQLAlchemy==1.3.17
pymysql
Dockerfile
Dockerfile
FROM python:3.7-slim
WORKDIR /mnt
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
docekr-compose.yml
docker-compose.yml
version: '2'
services:
graphql:
build: .
volumes:
- './:/mnt'
ports:
- "5000:5000"
tty: true
db:
image: mysql:5.7
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_DATABASE: test
MYSQL_ROOT_PASSWORD: test
MYSQL_USER: test
MYSQL_PASSWORD: test
ports:
- "3306:3306"
Other files are [Python (Flask) with GraphQL Server implementing SQLAlchemy, graphene, and SQLite](https://medium.com/swlh/python-flask-with-graphql-server-with-sqlalchemy-and-graphene-and See -sqlite-ac9fcc9d3d83)
Execute the following command
$ docker-compose up -d
Go to http: // localhost: 5000 / graphql
Success if the following screen is displayed!
Recommended Posts