0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

dashアプリのコンテナ化

Posted at

サマリ
 ①dashサンプルアプリ作成
→②コンテナ化
 ③AWSデプロイ


dashアプリのコンテナ化

gunicorn化

gunicornインストール

pip install gunicorn

requirements.txt更新

pip freeze > requirements.txt

main.py修正

server = Flask(__name__)
app = Dash(name=__name__ , server=server)
#修正前
#app = Dash(__name__)

Dockerfile作成

FROM python:3.10

ENV DEBIAN_FRONTEND noninteractive
ENV PROJECT_ROOTDIR /work/
WORKDIR $PROJECT_ROOTDIR

COPY ./requirements.txt $PROJECT_ROOTDIR
COPY ./main.py $PROJECT_ROOTDIR

RUN pip install -U pip && \
    pip install -r requirements.txt

docker-compose.yml作成

docker-compose.yml
FROM python:3.10

ENV DEBIAN_FRONTEND noninteractive
ENV PROJECT_ROOTDIR /work/
WORKDIR $PROJECT_ROOTDIR

COPY ./requirements.txt $PROJECT_ROOTDIR
COPY ./main.py $PROJECT_ROOTDIR

RUN pip install -U pip && \
    pip install -r requirements.txt

EXPOSE 8050

試しに実行

docker-compose up -d
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?