2

我对 Docker 很陌生,目前非常困惑。

我正在尝试使用带有以下容器的 Laradock 设置开发环境:

  1. laravel(工作区图像);
  2. php-fpm;
  3. 后勤;
  4. pgadmin4;
  5. python(仍然没有完成配置);
  6. nginx。

这在我的本地机器(Mac)上运行良好,但我不知道如何在服务器上上传项目(这是我的目标)。而且我想在“生产”服务器上开发以检查响应时间等。

我现在正在使用dockerdocker-compose

docker-compose.yml 部分:

workspace:
  build:
    context: ./workspace
    args:
      - LARADOCK_PHP_VERSION=${PHP_VERSION}
      - LARADOCK_PHALCON_VERSION=${PHALCON_VERSION}
      - INSTALL_SUBVERSION=${WORKSPACE_INSTALL_SUBVERSION}
      - INSTALL_XDEBUG=${WORKSPACE_INSTALL_XDEBUG}
      - INSTALL_PHPDBG=${WORKSPACE_INSTALL_PHPDBG}
      - INSTALL_BLACKFIRE=${INSTALL_BLACKFIRE}
      - INSTALL_SSH2=${WORKSPACE_INSTALL_SSH2}
      - INSTALL_GMP=${WORKSPACE_INSTALL_GMP}
      - INSTALL_SOAP=${WORKSPACE_INSTALL_SOAP}
      - INSTALL_LDAP=${WORKSPACE_INSTALL_LDAP}
      - INSTALL_IMAP=${WORKSPACE_INSTALL_IMAP}
      - INSTALL_MONGO=${WORKSPACE_INSTALL_MONGO}
      - INSTALL_AMQP=${WORKSPACE_INSTALL_AMQP}
      - INSTALL_PHPREDIS=${WORKSPACE_INSTALL_PHPREDIS}
      - INSTALL_MSSQL=${WORKSPACE_INSTALL_MSSQL}
      - INSTALL_NODE=${WORKSPACE_INSTALL_NODE}
      - NPM_REGISTRY=${WORKSPACE_NPM_REGISTRY}
      - INSTALL_YARN=${WORKSPACE_INSTALL_YARN}
      - INSTALL_NPM_GULP=${WORKSPACE_INSTALL_NPM_GULP}
      - INSTALL_NPM_BOWER=${WORKSPACE_INSTALL_NPM_BOWER}
      - INSTALL_NPM_VUE_CLI=${WORKSPACE_INSTALL_NPM_VUE_CLI}
      - INSTALL_DRUSH=${WORKSPACE_INSTALL_DRUSH}
      - INSTALL_DRUPAL_CONSOLE=${WORKSPACE_INSTALL_DRUPAL_CONSOLE}
      - INSTALL_AEROSPIKE=${WORKSPACE_INSTALL_AEROSPIKE}
      - AEROSPIKE_PHP_REPOSITORY=${AEROSPIKE_PHP_REPOSITORY}
      - INSTALL_V8JS=${WORKSPACE_INSTALL_V8JS}
      - COMPOSER_GLOBAL_INSTALL=${WORKSPACE_COMPOSER_GLOBAL_INSTALL}
      - COMPOSER_REPO_PACKAGIST=${WORKSPACE_COMPOSER_REPO_PACKAGIST}
      - INSTALL_WORKSPACE_SSH=${WORKSPACE_INSTALL_WORKSPACE_SSH}
      - INSTALL_LARAVEL_ENVOY=${WORKSPACE_INSTALL_LARAVEL_ENVOY}
      - INSTALL_LARAVEL_INSTALLER=${WORKSPACE_INSTALL_LARAVEL_INSTALLER}
      - INSTALL_DEPLOYER=${WORKSPACE_INSTALL_DEPLOYER}
      - INSTALL_PRESTISSIMO=${WORKSPACE_INSTALL_PRESTISSIMO}
      - INSTALL_LINUXBREW=${WORKSPACE_INSTALL_LINUXBREW}
      - INSTALL_MC=${WORKSPACE_INSTALL_MC}
      - INSTALL_SYMFONY=${WORKSPACE_INSTALL_SYMFONY}
      - INSTALL_PYTHON=${WORKSPACE_INSTALL_PYTHON}
      - INSTALL_IMAGE_OPTIMIZERS=${WORKSPACE_INSTALL_IMAGE_OPTIMIZERS}
      - INSTALL_IMAGEMAGICK=${WORKSPACE_INSTALL_IMAGEMAGICK}
      - INSTALL_TERRAFORM=${WORKSPACE_INSTALL_TERRAFORM}
      - INSTALL_DUSK_DEPS=${WORKSPACE_INSTALL_DUSK_DEPS}
      - INSTALL_PG_CLIENT=${WORKSPACE_INSTALL_PG_CLIENT}
      - INSTALL_PHALCON=${WORKSPACE_INSTALL_PHALCON}
      - INSTALL_SWOOLE=${WORKSPACE_INSTALL_SWOOLE}
      - INSTALL_LIBPNG=${WORKSPACE_INSTALL_LIBPNG}
      - INSTALL_IONCUBE=${WORKSPACE_INSTALL_IONCUBE}
      - PUID=${WORKSPACE_PUID}
      - PGID=${WORKSPACE_PGID}
      - CHROME_DRIVER_VERSION=${WORKSPACE_CHROME_DRIVER_VERSION}
      - NODE_VERSION=${WORKSPACE_NODE_VERSION}
      - YARN_VERSION=${WORKSPACE_YARN_VERSION}
      - DRUSH_VERSION=${WORKSPACE_DRUSH_VERSION}
      - TZ=${WORKSPACE_TIMEZONE}
      - BLACKFIRE_CLIENT_ID=${BLACKFIRE_CLIENT_ID}
      - BLACKFIRE_CLIENT_TOKEN=${BLACKFIRE_CLIENT_TOKEN}
  volumes:
    - ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER}
  extra_hosts:
    - "dockerhost:${DOCKER_HOST_IP}"
  ports:
    - "${WORKSPACE_SSH_PORT}:22"
  tty: true
  environment:
    - PHP_IDE_CONFIG=${PHP_IDE_CONFIG}
  networks:
    - frontend
    - backend

php-fpm:

php-fpm: build: context: ./php-fpm args: - LARADOCK_PHP_VERSION=${PHP_VERSION} - LARADOCK_PHALCON_VERSION=${PHALCON_VERSION} - INSTALL_XDEBUG=${PHP_FPM_INSTALL_XDEBUG} - INSTALL_PHPDBG=${PHP_FPM_INSTALL_PHPDBG} - INSTALL_BLACKFIRE=${INSTALL_BLACKFIRE} - INSTALL_SSH2=${PHP_FPM_INSTALL_SSH2} - INSTALL_SOAP=${PHP_FPM_INSTALL_SOAP} - INSTALL_IMAP=${PHP_FPM_INSTALL_IMAP} - INSTALL_MONGO=${PHP_FPM_INSTALL_MONGO} - INSTALL_AMQP=${PHP_FPM_INSTALL_AMQP} - INSTALL_MSSQL=${PHP_FPM_INSTALL_MSSQL} - INSTALL_ZIP_ARCHIVE=${PHP_FPM_INSTALL_ZIP_ARCHIVE} - INSTALL_BCMATH=${PHP_FPM_INSTALL_BCMATH} - INSTALL_GMP=${PHP_FPM_INSTALL_GMP} - INSTALL_PHPREDIS=${PHP_FPM_INSTALL_PHPREDIS} - INSTALL_MEMCACHED=${PHP_FPM_INSTALL_MEMCACHED} - INSTALL_OPCACHE=${PHP_FPM_INSTALL_OPCACHE} - INSTALL_EXIF=${PHP_FPM_INSTALL_EXIF} - INSTALL_AEROSPIKE=${PHP_FPM_INSTALL_AEROSPIKE} - AEROSPIKE_PHP_REPOSITORY=${AEROSPIKE_PHP_REPOSITORY} - INSTALL_MYSQLI=${PHP_FPM_INSTALL_MYSQLI} - INSTALL_PGSQL=${PHP_FPM_INSTALL_PGSQL} - INSTALL_PG_CLIENT=${PHP_FPM_INSTALL_PG_CLIENT} - INSTALL_INTL=${PHP_FPM_INSTALL_INTL} - INSTALL_GHOSTSCRIPT=${PHP_FPM_INSTALL_GHOSTSCRIPT} - INSTALL_LDAP=${PHP_FPM_INSTALL_LDAP} - INSTALL_PHALCON=${PHP_FPM_INSTALL_PHALCON} - INSTALL_SWOOLE=${PHP_FPM_INSTALL_SWOOLE} - INSTALL_IMAGE_OPTIMIZERS=${PHP_FPM_INSTALL_IMAGE_OPTIMIZERS} - INSTALL_IMAGEMAGICK=${PHP_FPM_INSTALL_IMAGEMAGICK} - INSTALL_CALENDAR=${PHP_FPM_INSTALL_CALENDAR} - INSTALL_FAKETIME=${PHP_FPM_INSTALL_FAKETIME} - INSTALL_IONCUBE=${PHP_FPM_INSTALL_IONCUBE} volumes: - ./php-fpm/php${PHP_VERSION}.ini:/usr/local/etc/php/php.ini - ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER} expose: - "9000" extra_hosts: - "dockerhost:${DOCKER_HOST_IP}" environment: - PHP_IDE_CONFIG=${PHP_IDE_CONFIG} - DOCKER_HOST=tcp://docker-in-docker:2375 - FAKETIME=${PHP_FPM_FAKETIME} depends_on: - workspace networks: - backend links: - docker-in-docker

postgres:

postgres:
      image: postgres:latest
      ports:
        - "${POSTGRES_PORT}:${POSTGRES_PORT}"
      environment:
        - POSTGRES_DB=${POSTGRES_DB}
        - POSTGRES_USER=${POSTGRES_USER}
        - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      networks:
        - backend

pgadmin4:

    pgadmin:
  build: ./pgadmin
  ports:
    - "5050:5050"
  volumes:
    - ${DATA_PATH_HOST}/pgadmin-backup:/var/lib/pgadmin/storage/pgadmin4
  depends_on:
    - postgres
  networks:
    - frontend
    - backend

nginx:

    nginx:
  build:
    context: ./nginx
    args:
      - PHP_UPSTREAM_CONTAINER=${NGINX_PHP_UPSTREAM_CONTAINER}
      - PHP_UPSTREAM_PORT=${NGINX_PHP_UPSTREAM_PORT}
      - CHANGE_SOURCE=${CHANGE_SOURCE}
  volumes:
    - ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER}
    - ${NGINX_HOST_LOG_PATH}:/var/log/nginx
    - ${NGINX_SITES_PATH}:/etc/nginx/sites-available
    - ${NGINX_SSL_PATH}:/etc/nginx/ssl
  ports:
    - "${NGINX_HOST_HTTP_PORT}:80"
    - "${NGINX_HOST_HTTPS_PORT}:443"
  depends_on:
    - php-fpm
  networks:
    - frontend
    - backend

Python:

python:构建:上下文:./python-socket 端口:-“9095:9095”卷:-${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER}

鉴于我对服务器具有 sftp 访问权限和 ssh 访问权限,如何部署和开发这个项目?没有任何简单的方法可以将项目部署到服务器并进行快速代码更新以进行测试吗?

4

0 回答 0