0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Laravelでアプリを作成してみた【ミニ受注入力システム】

Last updated at Posted at 2023-01-27

環境開発の作成

①ターミナルを起動し、プロジェクトフォルダーを作成する

mkdir <project>
cd <project>

②次にルートフォルダにファイルを作成し、内容(dockerの構成)を以下にする
docker-compose.yml
Dockerfile

docker-compose.yml
version: '3.7'

services:
  php:
    build: .
    volumes:
      - ./src:/var/www/html
    ports:
      - '8000:8000'
  mysql:
    image: mysql:5.7
    ports:
      - '3306:3306'
    volumes:
      - ./db:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: password
      MYSQL_DATABASE: laravel
//Dockerfile

FROM php:7.4-fpm

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

RUN apt-get update && apt-get install -y zip unzip

RUN docker-php-ext-install pdo pdo_mysql

開発環境立ち上げ

//terminal
docker-compose up -d

コンテナが起動したら成功

Creating laravel_todo_mysql_1 ... done
Creating laravel_todo_php_1   ... done
//terminal
docker ps

下記のようにPHPとMySQLコンテナが立ち上がっていれば環境構築成功

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                               NAMES
dc165c1c61af        mysql:5.7           "docker-entrypoint.s…"   18 seconds ago      Up 18 seconds       0.0.0.0:3306->3306/tcp, 33060/tcp   laravel_todo_mysql_1
f01498ef3163        laravel_todo_php    "docker-php-entrypoi…"   18 seconds ago      Up 18 seconds       0.0.0.0:8000->8000/tcp, 9000/tcp    laravel_todo_php_1

Laravelインストール

docker-compose exec php composer create-project --prefer-dist "laravel/laravel=6.*" .

下記メッセージで成功

> @php artisan key:generate --ansi
Application key set successfully.

開発サーバー立ち上げてインストールされているか確認

docker-compose exec php php artisan serve --host=0.0.0.0 --port=8000

参考サイト

Webアプリケーションを作りながら覚える!!#1 LaravelとBootstrapで作るTodoアプリケーション開発(環境構築編)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?