gpt4 book ai didi

amazon-web-services - Docker Cloud的栈文件怎么写?

转载 作者:行者123 更新时间:2023-12-03 21:09:54 25 4
gpt4 key购买 nike

我的主要目标是通过 docker stack 将我的 Laravel 5.1 站点部署到我的 docker cloud 中。

  • 我已经将我的 DockerCloud 账户与我的 AWS 账户相关联。
  • 我已经有:

    1. docker-compose.yml
    2. app.docker文件
    3. web.docker文件

docker-compose.yml

version: '2'
services:
# The Application
app:
build:
context: ./
dockerfile: app.dockerfile
working_dir: /var/www
volumes:
- ./:/var/www
environment:
- "DB_PORT=3306"
- "DB_HOST=45.55.88.57"

# The Web Server
web:
build:
context: ./
dockerfile: web.dockerfile
working_dir: /var/www
volumes_from:
- app
ports:
- 85:80
volumes:
dbdata:

app.dockerfile

FROM php:7.0.4-fpm
RUN apt-get update && apt-get install -y libmcrypt-dev \
mysql-client libmagickwand-dev --no-install-recommends \
&& pecl install imagick \
&& docker-php-ext-enable imagick \
&& docker-php-ext-install mcrypt pdo_mysql

web.docker 文件

  FROM nginx:1.10
ADD vhost.conf /etc/nginx/conf.d/default.conf

vhost.conf

 server {
listen 80;
index index.php index.html;
root /var/www/public;

location / {
try_files $uri /index.php?$args;
}

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass app:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}

结果

enter image description here

http://localhost:85

它在本地完美工作正常。

enter image description here

目标

enter image description here

有了我得到的所有 docker 文件,我该如何为 Docker Cloud 编写堆栈文件?

最佳答案

我会尝试 Elastic Beanstalk。请看here .所以你需要将 docker-compose.yml 修改为 Dockerrun.aws.json。

关于amazon-web-services - Docker Cloud的栈文件怎么写?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47213931/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com