麻烦部署Docker Image Flask AWS aws beanstalker
我正在尝试使用烧瓶部署机器学习模型,然后使用Docker构建图像,最后用于CI \ CD,并将其部署在AWS Beanstalk上。 烧瓶应用程序在Localhost和Docker Image Run命令上运行良好。
我的整个项目在这里: end2endml
我有以下问题> 502 Bad Gateway
到目前为止:
我有一个dockerfile和docker-compose.yml用于部署。他们看起来像这样:
FROM python:3.7-slim-bullseye
WORKDIR /app
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Install dependencies:
COPY . /app
RUN pip install -r /app/requirements/requirements.txt
EXPOSE 5000
# Run the application:
CMD ["python", "/app/classification_model/application.py"]
---> My docker Compose
# Docker compose for Amazon
version: '3'
services:
aws_deployment:
# This function forces Dockerfile
build:
# Files (look at the current dir)
context: .
# Look for this file
dockerfile: Dockerfile
ports:
- "80:5000"
--> My Travis file
#autom install a copy of docker
services:
- docker
# Do before : -f force -t anynameyouwantforyourimage
before_install:
- docker build -t raudez77/end2end-machine-learning -f Dockerfile .
# Run test
# Script contents all script to run
script:
- docker run raudez77/end2end-machine-learning python test.py -- --coverage
#Deploy into Amazon ElasticBeanstalk
deploy:
# Use this Saas for deployment
provider: elasticbeanstalk
region: "us-west-2"
# Application name
app: "docker_titanic"
# Enviroment
env: "Dockertitanic-env"
# Go Services- S3 - look for yout us-west-2 elastickbeanstalk
bucket_name: "elasticbeanstalk-us-west-2-082124557004"
bucket_path : "docker_titanic"
# Create Acces key in Travis
access_key_id: $AWS_ACCESS_KEY
secret_access_key: "$AWS_SECRET_KEY"
on:
branch: master
skip_cleanup: true ```
I am trying to deploy a machine learning model using flask, then I used docker to build an image, and finally Travis for CI\CD and deploy it on AWS Beanstalk.
the Flask application runs well on localhost and docker image run command.
My entire project is here: end2endML
I am having the following problem > 502 Bad Gateway
Until now :
- It is running on 64bit Amazon Linux 2/3.4.15 -I don't find any other option-
- I have read about the port 80 or 5000 I have tried both and they failed
- I read the Log and received this message
I have a Dockerfile and Docker-compose.yml for deployment. and they look like this:
FROM python:3.7-slim-bullseye
WORKDIR /app
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Install dependencies:
COPY . /app
RUN pip install -r /app/requirements/requirements.txt
EXPOSE 5000
# Run the application:
CMD ["python", "/app/classification_model/application.py"]
---> My docker Compose
# Docker compose for Amazon
version: '3'
services:
aws_deployment:
# This function forces Dockerfile
build:
# Files (look at the current dir)
context: .
# Look for this file
dockerfile: Dockerfile
ports:
- "80:5000"
--> My Travis file
#autom install a copy of docker
services:
- docker
# Do before : -f force -t anynameyouwantforyourimage
before_install:
- docker build -t raudez77/end2end-machine-learning -f Dockerfile .
# Run test
# Script contents all script to run
script:
- docker run raudez77/end2end-machine-learning python test.py -- --coverage
#Deploy into Amazon ElasticBeanstalk
deploy:
# Use this Saas for deployment
provider: elasticbeanstalk
region: "us-west-2"
# Application name
app: "docker_titanic"
# Enviroment
env: "Dockertitanic-env"
# Go Services- S3 - look for yout us-west-2 elastickbeanstalk
bucket_name: "elasticbeanstalk-us-west-2-082124557004"
bucket_path : "docker_titanic"
# Create Acces key in Travis
access_key_id: $AWS_ACCESS_KEY
secret_access_key: "$AWS_SECRET_KEY"
on:
branch: master
skip_cleanup: true ```
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论