[Docker] Build an environment of python (Flask) + GraphQL (graphene) + MySQL (sqlalchemy)

Introduction

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)

Required files, directories

.
├── docker-compose.yml
├── Dockerfile
├── requirements.txt
├── books/← Refer to the above site

File contents

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)

Run

Execute the following command

$ docker-compose up -d

Go to http: // localhost: 5000 / graphql

Success if the following screen is displayed!

スクリーンショット 2020-10-05 23.37.17.png

Recommended Posts

[Docker] Build an environment of python (Flask) + GraphQL (graphene) + MySQL (sqlalchemy)
Build Mysql + Python environment with docker
[Django] Memo to create an environment of Django + MySQL + Vue.js [Python]
Build and try an OpenCV & Python environment in minutes using Docker
Build an environment for Blender built-in Python
Build Jupyter Lab (Python) environment with Docker
Build NGINX + NGINX Unit + MySQL environment with Docker
Environment construction of Flask / MySql / Apache / mod_wsgi / virtualenv with Redhat7 (Python2.7) November 2020
Build a Python + bottle + MySQL environment with Docker on RaspberryPi3! [Easy construction]
Build Python + django + nginx + MySQL environment using docekr
Prepare the execution environment of Python3 with Docker
Create an environment of 64bit Windows + python 2.7 + MeCab 0.996
[Python] Build a Django development environment with Docker
Installation of Python3 and Flask [Environment construction summary]
Super easy! Python + Flask environment in Docker quickly
Build Python3 + flask environment on GCP Compute Engine
Build PyPy and Python execution environment with Docker
How to build an environment for using multiple versions of Python on Mac
Build a Python + bottle + MySQL environment with Docker on RaspberryPi3! [Trial and error]
Virtual environment construction with Docker + Flask (Python) + Jupyter notebook
Build an interactive environment for machine learning in Python
Unification of Python environment
How to build a Django (python) environment on docker
Build a Python virtual environment using venv (Django + MySQL ①)
[Cloud9] Try to build an environment with django 1.11 of Python 3.4 without understanding even 1 mm
[Sakura Rental Server] (For beginners) How to build an environment for Python, pyenv, and Flask. | For csh
Build an environment for machine learning using Python on MacOSX
Build an Ubuntu python development environment on Google Cloud Platform
Introducing Kaggle's Docker Image on Windows to build an environment
Create a Todo app with Django ① Build an environment with Docker
Build a Flask development environment at low cost using Docker
Build an Anaconda virtual environment
Build python3 environment with ubuntu 16.04
Build Python environment on Windows
Prepare python3 environment with Docker
Build python environment with direnv
[ev3dev × Python] Build ev3dev development environment
Build python environment on windows
Build a Python environment offline
Environment construction of python2 & 3 (OSX)
Build and test a CI environment for multiple versions of Python
Building an HPC learning environment using Docker Compose (C, Python, Fortran)
Build a development environment using Jupyter and Flask with Python in Docker (supports both VS Code / code-server)
Build python virtual environment with virtualenv
Build a go environment using Docker
Studying Python Part.1 Creating an environment
Build Flask environment with Dockerfile + docker-compose.yml
Build PyPy execution environment with Docker
Environment construction of python3.8 on mac
Build Python 3.8 + Pipenv environment on Ubuntu 18.04
Build a python3 environment on CentOS7
Docker environment update: add Python package
[docker] python3.5 + numpy + matplotlib environment construction
Application development with Docker + Python + Flask
Connect to MySQL using Flask SQLAlchemy
Prepare an environment to touch grib2 format files with python (Docker edition)
[Mac] Build a Python 3.x environment at the fastest speed using Docker