Skip to content

Commit

Permalink
🎉 firsi commit🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
morishi46rui committed Jan 14, 2025
0 parents commit d1bb145
Show file tree
Hide file tree
Showing 127 changed files with 17,934 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.vscode

72 changes: 72 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# build && ホストマシンにパッケージインストール
build:
docker compose build && make modb
buildn:
docker compose build --no-cache && make modb
buildb:
docker compose build app && make modb

# buildせずパッケージをインストール
modb:
docker compose run --rm app composer install

# 起動
up:
docker compose up
upd:
docker compose up -d

# 再起動
re:
docker compose restart

# シャットダウン
down:
docker compose down --remove-orphans

# コンテナ内に入る
b:
docker compose exec app bash

# 初期データ投入
seed:
docker compose exec app bash -c "php artisan migrate:fresh && php artisan db:seed"

# volume以外を削除
prune:
docker system prune

# lintとformat
fix:
make fixb

fixb:
docker compose up -d db && \
docker compose run --rm app php artisan clockwork:clean -a && \
docker compose run --rm app bash -c "vendor/bin/pint && \
vendor/bin/phpcbf --standard=PSR12 app/ && \
vendor/bin/psalm && \
vendor/bin/phpmd app/ text phpmd.xml && \
vendor/bin/phpcs --standard=PSR12 app/ && \
php artisan test || true"

# OpenApi Schemaの生成/更新
api:
chmod 777 backend/storage/api-docs/api-docs.json && \
docker compose run --rm app bash -c "php artisan openapi:generate-routes && \
php artisan l5-swagger:generate && \
spectral lint storage/api-docs/api-docs.json"

# 開発環境構築
init:
cp ./app/.env.example ./app/.env && \
make buildn && \
make upd && \
make seed && \
docker compose exec -it db mysql -u root -p -e \
"SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'laraveltest';" \
| grep -q laraveltest || docker compose exec -it db mysql -u root -p -e "CREATE DATABASE laraveltest;"

cho:
chown -R www-data app/storage
docker compose exec app chmod -R a+w /var/www/bootstrap/cache
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# morishi_api

## バックエンド起動時
- swaggerUI: http://localhost:8000/api/documentation/
18 changes: 18 additions & 0 deletions backend/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[docker-compose.yml]
indent_size = 4
48 changes: 48 additions & 0 deletions backend/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost:8080

LOG_CHANNEL=stdout
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

# SQLログを出力
LOG_SQL_ENABLE=true
LOG_SQL_SLOW_QUERY_TIME=1000

# For Dockerコンテナ
DB_CONNECTION=mysql
DB_HOST=db
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=root

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
SESSION_DRIVER=file
SESSION_LIFETIME=120

# 開発用メールサーバー(mailpit)
MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"

QUEUE_CONNECTION=sync # sync, database, redis
REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6379

L5_SWAGGER_GENERATE_ALWAYS=true
L5_SWAGGER_OPEN_API_SPEC_VERSION=3.1.0

# NOTE: SQID_ALPHABETを変更する場合、既存レコードのSQIDが変わるため注意
SQID_ALPHABET=
11 changes: 11 additions & 0 deletions backend/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
* text=auto eol=lf

*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php

/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore
21 changes: 21 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/.phpunit.cache
/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.env.backup
.env.production
.phpunit.result.cache
Homestead.json
Homestead.yaml
auth.json
npm-debug.log
yarn-error.log
/.fleet
/.idea
/.vscode
.DS_Store
.pint.cache
1 change: 1 addition & 0 deletions backend/.spectral.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extends: ["spectral:oas"]
60 changes: 60 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
FROM php:8.3.10-fpm

# ビルドキャッシュの削除を無効化
# 参考: https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/reference.md#run---mounttypecache
RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache

# 必要なライブラリのインストール
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && apt-get install -y --no-install-recommends \
libpng-dev \
libonig-dev \
libxml2-dev \
zip \
unzip \
libfreetype6-dev \
libjpeg62-turbo-dev \
libzip-dev \
locales \
cron \
&& docker-php-ext-install mbstring exif pcntl bcmath gd pdo_mysql \
&& pecl install xdebug \
&& docker-php-ext-enable xdebug

# spectral CLI(API linter)のインストール
RUN curl -L https://raw.github.com/stoplightio/spectral/master/scripts/install.sh | sh

# 日本語設定
RUN echo "ja_JP.UTF-8 UTF-8" > /etc/locale.gen && locale-gen

# Composerのインストール
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

WORKDIR /var/www

# Laravelプロジェクトのファイルをコンテナにコピー
COPY . /var/www/

# rootユーザーでcomposerインストールを許可
ENV COMPOSER_ALLOW_SUPERUSER=1

# Composerを使ってLaravelプロジェクトの依存関係をインストール
RUN composer install

# 権限の設定
RUN chown -R www-data:www-data /var/www/storage /var/www/bootstrap/cache

# storageのシンボリックリンク作成
RUN php artisan storage:link

# cronジョブの設定
COPY crontab /etc/cron.d/laravel-cron
RUN chmod 0644 /etc/cron.d/laravel-cron
RUN crontab /etc/cron.d/laravel-cron

# php.ini を設定ディレクトリにコピー
COPY php/local.ini /usr/local/etc/php/php.ini

# 開発サーバー起動コマンド
CMD ["sh", "-c", "cron && php artisan serve --host=0.0.0.0 --port=8000"]
66 changes: 66 additions & 0 deletions backend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>

<p align="center">
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>

## About Laravel

Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:

- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).

Laravel is accessible, powerful, and provides tools required for large, robust applications.

## Learning Laravel

Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.

You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.

If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.

## Laravel Sponsors

We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com).

### Premium Partners

- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[WebReinvent](https://webreinvent.com/)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[DevSquad](https://devsquad.com/hire-laravel-developers)**
- **[Jump24](https://jump24.co.uk)**
- **[Redberry](https://redberry.international/laravel/)**
- **[Active Logic](https://activelogic.com)**
- **[byte5](https://byte5.de)**
- **[OP.GG](https://op.gg)**

## Contributing

Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).

## Code of Conduct

In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).

## Security Vulnerabilities

If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [[email protected]](mailto:[email protected]). All security vulnerabilities will be promptly addressed.

## License

The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
Loading

0 comments on commit d1bb145

Please sign in to comment.