Giter VIP home page Giter VIP logo

docker-laravel's Issues

docker-compose build GPG error

$ docker-compose build
...

+ apt-get update
Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
Get:2 http://deb.debian.org/debian buster InRelease [122 kB]
Get:3 http://deb.debian.org/debian buster-updates InRelease [51.9 kB]
Err:1 http://security.debian.org/debian-security buster/updates InRelease
  At least one invalid signature was encountered.
Err:2 http://deb.debian.org/debian buster InRelease
  At least one invalid signature was encountered.
Err:3 http://deb.debian.org/debian buster-updates InRelease
  At least one invalid signature was encountered.
Reading package lists...
W: GPG error: http://security.debian.org/debian-security buster/updates InRelease: At least one invalid signature was encountered.
E: The repository 'http://security.debian.org/debian-security buster/updates InRelease' is not signed.
W: GPG error: http://deb.debian.org/debian buster InRelease: At least one invalid signature was encountered.
E: The repository 'http://deb.debian.org/debian buster InRelease' is not signed.
W: GPG error: http://deb.debian.org/debian buster-updates InRelease: At least one invalid signature was encountered.
E: The repository 'http://deb.debian.org/debian buster-updates InRelease' is not signed.
Removing intermediate container c12d9ca46d6e

Explicitly specify the context on Docker Compose

Before

services:
  app:
    build: ./infra/docker/php

After

services:
  app:
    build:
      context: .
      dockerfile: ./infra/docker/php/Dockerfile

By putting the root directory in the Docker context, the Dockerfile will be able to access any file.

Add npm command to Makefile

npm-install:
	docker-compose exec web npm install
npm-dev:
	docker-compose exec web npm run dev
npm-watch:
	docker-compose exec web npm run watch
npm-watch-poll:
	docker-compose exec web npm run watch-poll
npm-hot:
	docker-compose exec web npm run hot

Add env cache files

Change the generated path of the cache file to /tmp

Artisan Command

$ php artisan clear-compiled
$ composer dump-autoload

bootstrap/cache/services.php
bootstrap/cache/packages.php

$ php artisan config:clear
$ php artisan config:cache

bootstrap/cache/config.php

$ php artisan route:clear
$ php artisan route:cache

bootstrap/cache/routes.php

$ php artisan event:clear
$ php artisan event:cache

bootstrap/cache/events.php

$ php artisan view:clear
$ php artisan cache:clear
  • storage/framework/views
  • storage/framework/cache/data

Environment

APP_SERVICES_CACHE=/tmp/cache/services.php
APP_PACKAGES_CACHE=/tmp/cache/packages.php
APP_CONFIG_CACHE=/tmp/cache/config.php
APP_ROUTES_CACHE=/tmp/cache/routes.php
APP_EVENTS_CACHE=/tmp/cache/events.php
VIEW_COMPILED_PATH=/tmp/cache/views
SESSION_DRIVER=cookie
LOG_CHANNEL=stderr

Reference

Review directory structure

Before

.
├── infrastructure
│   ├── .env
│   ├── .gitignore
│   ├── Makefile
│   ├── docker
│   │   ├── mysql
│   │   ├── nginx
│   │   └── php
│   └── docker-compose.yml

After

.
├── infra
│   ├── .gitignore
│   └── docker
│       ├── mysql
│       ├── nginx
│       └── php
├── Makefile
└── docker-compose.yml
  • .env Not required
  • infrastructure => infra Simple name
  • Makefile Can be run in the project root directory

Improve environment variable settings

Challenges

  • Updating the Laravel environment variables requires it takes time and effort and rebuilding the Dockerfile.
  • Duplicate management of Dockerfile and Laravel .env
  • I don't want to edit docker-compose.yml to avoid duplicate public port numbers.

Reflect some feedback

  • No Dockerfile.production file required
  • Add --seed option to make fresh command
  • Add make rollback-test command
  • Add npm command to web container
  • Show composer version on GitHub Action

phpのDockerfileについてです。

すみません。PHPの初心者で学習中の者です。こちらのqiitaで大変勉強になりいつも有難う御座います。

ただ今貴方様のこちらのDocker-laravelのファイルを参考にして独学でPHPを勉強しようと, macにphp7.4-fpm-buster+nginx+mysql8+phpmyadmin/phpmyadminで構築して”いちばんやさしいPHPの教本”を勉強しました。
他の目的に近い参考にしたサイトです。
https://php-archive.net/php/docker-php-environment/
https://qiita.com/nemui_/items/f911be7ffa4f29293fd5, etc..

殆どのサイト通りは全く構築出来ませんでしたが貴方様のDocker-laravelのphpの設定Dockerfileで構築出来ました。深く感謝したします。

前書き長く申し訳ありません。以前数週間前の貴方様のphpの設定ファイルのDockerfileの記述で、

PHP のDockerfile構成

FROM php:7.4-fpm-buster

SHELL ["/bin/bash", "-oeux", "pipefail", "-c"]
ENV TZ=UTC \
    # locale
    LANG=en_US.UTF-8 \
    LANGUAGE=en_US:en \
    LC_ALL=en_US.UTF-8 \
    # composer environment
    COMPOSER_ALLOW_SUPERUSER=1 \
    COMPOSER_HOME=/composer 

COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

RUN apt-get update && \
    apt-get -y install git libicu-dev libonig-dev libzip-dev unzip locales && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/* && \
    locale-gen en_US.UTF-8 && \
    localedef -f UTF-8 -i en_US en_US.UTF-8 && \
    mkdir /var/run/php-fpm && \
    mkdir(--こちらに書いてあった記述を教えて下さい--)
    docker-php-ext-install intl pdo_mysql mbstring zip bcmath && \
    composer config -g process-timeout 3600 && \
    composer config -g repos.packagist composer https://packagist.jp && \
    composer global require hirak/prestissimo

COPY php.ini /usr/local/etc/php/

**以前に

mkdir /var/run/php-fpm && \

の下にもう一つ

`mkdir ~~`

の記述で稼動できました。**
こちらの記述を覚えていらっしゃいますか??お忙しいところ恐れ入りますが何卒よろしく御願い致します。m(_ _)m
佐藤秀人

make install-recommend-packages が失敗する

❯ cat /etc/os-release
NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"

ややレアな環境だとは思うのですが、以下のコンソール出力で make install-recommend-packages が失敗します

❯ sudo make install-recommend-packages
docker-compose exec app composer require doctrine/dbal
Using version ^3.0 for doctrine/dbal
./composer.json has been updated
Running composer update doctrine/dbal
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - barryvdh/laravel-ide-helper is locked to version v2.8.2 and an update of this package was not requested.
    - barryvdh/laravel-ide-helper v2.8.2 requires doctrine/dbal ~2.3 -> found doctrine/dbal[2.3.0-BETA1, ..., 2.12.x-dev] but it conflicts with your root composer.json require (^3.0).

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.
make: *** [install-recommend-packages] エラー 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.