Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker環境でLaravelを動かす #3

Open
aokabin opened this issue Mar 29, 2020 · 8 comments
Open

Docker環境でLaravelを動かす #3

aokabin opened this issue Mar 29, 2020 · 8 comments

Comments

@aokabin
Copy link
Owner

aokabin commented Mar 29, 2020

No description provided.

@aokabin
Copy link
Owner Author

aokabin commented Mar 29, 2020

@aokabin
Copy link
Owner Author

aokabin commented Mar 29, 2020

あ、いい感じのページ発見

packagist.jpを使った方がいいという昔の情報から、こういうふうにしてみた

FROM php:7.4.4-fpm-alpine3.11
COPY php.ini /usr/local/etc/php/

RUN apk --no-cache update && \
    apk --no-cache upgrade && \
    apk --no-cache add \
    curl-dev \
    freetype-dev \
    libjpeg-turbo-dev \
    libpng-dev \
    libxml2-dev \
    zlib-dev \
    pcre-dev \
    g++ \
    make \
    autoconf \
    openssl \
    nodejs-npm \
    bash \
  && docker-php-ext-install \
    curl \
    dom \
    mbstring \
    pdo \
    pdo_mysql \
    simplexml \
    zip \
    opcache \
  && docker-php-ext-configure gd \
    --with-freetype-dir=/usr/include/ \
    --with-jpeg-dir=/usr/include/ \
    --with-png-dir=/usr/include/ \
  && docker-php-ext-install gd \
  && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
  && chmod +x /usr/local/bin/composer \
  && rm -rf /var/cache/apk/*

RUN composer global require "laravel/installer" && \
    composer self-update && \
    composer global require hirak/prestissimo && \
    composer config -g repos.packagist composer https://packagist.jp

ENV COMPOSER_ALLOW_SUPERUSER 1

ENV COMPOSER_HOME /composer

ENV PATH $PATH:/composer/vendor/bin
$ docker build .
(中略)
configure: error: Package requirements (oniguruma) were not met:

Package 'oniguruma', required by 'virtual:world', not found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables ONIG_CFLAGS
and ONIG_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

onigurumaエラーですわ、なんだっけ、どっかでみた気がする

なるほど、libong-devが必要、と

alpineではoniguruma-devらしい

    pcre-dev \
+   oniguruma-dev \
    g++ \
    make \

追加してみた

@aokabin
Copy link
Owner Author

aokabin commented Mar 29, 2020

次はlibzipエラーか

configure: error: Package requirements (libzip >= 0.11) were not met:

Package 'libzip', required by 'virtual:world', not found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables LIBZIP_CFLAGS
and LIBZIP_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
    oniguruma-dev \
+   libzip-dev \
    g++ \

今度は configure: error: unrecognized options: --with-freetype-dir, --with-jpeg-dir, --with-png-dir

うーん、これは、、、
docker-php-ext-configure コマンドの意味がわかってないかも

@aokabin
Copy link
Owner Author

aokabin commented Mar 29, 2020

docker-php-ext-configureとdocker-php-ext-installは、コンテナイメージに事前に圧縮されて入っているエクステンションを操作できます。

phpのコンテナ独自のやつかな

エラー文で調べてみる

あ、これかも?

  RUN docker-php-ext-configure gd
- --with-png-dir=/usr/include/
- --with-jpeg-dir=/usr/include/
- --with-freetype-dir=/usr/include/
+ --with-png=/usr/include/
+ --with-jpeg=/usr/include/
+ --with-freetype=/usr/include/

@aokabin
Copy link
Owner Author

aokabin commented Mar 29, 2020

pngでエラーなったけど、指定しなくてよくなったかも、って書いてあったわ

@aokabin
Copy link
Owner Author

aokabin commented Mar 29, 2020

お、ビルド通った

@aokabin
Copy link
Owner Author

aokabin commented Mar 29, 2020

あれ、laravelコマンドが入ってないな...
まぁ入ってなくてもいいかもしれないんだけど。。。

いらないのかもしれない

@aokabin
Copy link
Owner Author

aokabin commented Mar 29, 2020

次はdocker-composeを使って起動させてみる

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant