stakkr/docker-symfony

简单的Docker开发环境

安装: 11

依赖项: 0

建议者: 0

安全: 0

星标: 1

关注者: 2

分支: 0

开放问题: 0

语言:Shell

1.0.0 2018-06-19 22:10 UTC

This package is auto-updated.

Last update: 2024-09-29 00:02:09 UTC


README

使用小型Docker开发环境快速启动和运行。

文档

完整文档可以在 https://vessel.shippingdocker.com 找到。

安装

Stakkr 只是一组设置每个项目本地Docker开发环境的文件。除了Docker本身外,无需全局安装任何东西!

这就是使用它的全部内容

composer require stakkr/docker-symfony


# Run this once to initialize project
# Must run with "bash" until initialized
bash stakkr init

./stakkr start

在浏览器中转到 https:// 并查看您的Laravel网站!

您可以使用以下命令完成此操作

cp -R vendor/shipping-docker/vessel/docker-files/{vessel,docker-compose.yml,docker} .

然后您将能够正常安装和继续使用。

多个环境

Stakkr 尝试绑定到您机器上的80和3306端口,因此您只需在浏览器中转到 https:// 即可。

但是,如果您运行了多个Vessel实例,则在启动时将收到错误;每个端口只能使用一次。为了避免这种情况,通过以下两种方式之一设置每个项目的不同端口

.env 文件中

APP_PORT=8080
MYSQL_PORT=33060

或启动Stakkr时

APP_PORT=8080 MYSQL_PORT=33060 ./stakkr start

然后您可以在 https://:8080 查看您的项目,并从端口 33060 本地访问您的数据库;

常见命令

以下是一些您可以使用的内置辅助工具列表。任何未在 vessel 脚本中定义的命令都将默认传递给 docker-compose 命令。如果没有使用任何命令,它将运行 docker-compose ps 以列出此环境正在运行的容器。

启动和停止Vessel

# Start the environment
./stakkr start

## This is equivalent to
./stakkr up -d

# Stop the environment
./stakkr stop

## This is equivalent to
./stakkr down

开发

# Use composer
./stakkr composer <cmd>
./stakkr comp <cmd> # "comp" is a shortcut to "composer"

# Use artisan
./stakkr bin/console <cmd>
./stakkr console <cmd> # "console" is a shortcut to "bin/console"

# Run phpunit tests
./stakkr test

## Example: You can pass anything you would to phpunit to this as well
./stakkr test --filter=some.phpunit.filter
./stakkr test tests/Unit/SpecificTest.php


# Run npm
./stakkr npm <cmd>

## Example: install deps
./stakkr npm install

# Run yarn

./stakkr yarn <cmd>

## Example: install deps
./stakkr yarn install

# Run gulp
./stakkr gulp <cmd>

Docker命令

如前所述,任何未识别为内置命令的内容都将用作 docker-compose 命令的参数。这里有一些实用的技巧

# Both will list currently running containers and their status
./stakkr
./stakkr ps

# Check log output of a container service
./stakkr logs # all container logs
./stakkr logs app # nginx | php logs
./stakkr logs mysql # mysql logs
./stakkr logs redis # redis logs

## Tail the logs to see output as it's generated
./stakkr logs -f # all logs
./stakkr logs -f app # nginx | php logs

# Start a bash shell inside of a container
# This is just like SSH'ing into a server
# Note that changes to a container made this way will **NOT** 
#   survive through stopping and starting the vessel environment
#   To install software or change server configuration, you'll need to
#     edit the Dockerfile and run: ./vessel build
./stakkr exec app bash

包括什么?

此项目的目标是简单性。它包括

这是如何工作的?

如果您对Docker不熟悉,请尝试这个 Docker在开发中 课程,该课程解释了如何构建此项目的重点主题。

如果您想了解此工作流程是如何开发的,请查看 Shipping Docker 并注册免费课程模块,该模块解释了构建此Docker工作流程。

支持的系统

Stakkr 需要 Docker,目前仅在 Windows、Mac 和 Linux 上运行。

Windows 需要 Hyper-V 运行。支持使用 Git Bash (MINGW64) 和 WSL。原生 Windows 正在开发中。