This commit is contained in:
Andras Bacsai 2023-04-13 15:48:27 +02:00
parent 38315492a2
commit 408236b6b1
11 changed files with 90 additions and 9 deletions

23
.dockerignore Normal file
View File

@ -0,0 +1,23 @@
/.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
/.npm
/.bash_history
/_volumes/*

View File

@ -2,7 +2,9 @@
namespace App\Actions\Fortify;
use App\Models\Team;
use App\Models\User;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;
@ -31,10 +33,21 @@ public function create(array $input): User
'password' => $this->passwordRules(),
])->validate();
return User::create([
$team = Team::create([
'name' => explode(' ', $input['name'], 2)[0] . "'s Team",
'personal_team' => true,
'is_root_user' => User::count() == 0 ? true : false,
]);
$user = User::create([
'name' => $input['name'],
'email' => $input['email'],
'password' => Hash::make($input['password']),
]);
DB::table('team_user')->insert([
'team_id' => $user->id,
'user_id' => $team->id,
'role' => 'admin',
]);
return $user;
}
}

View File

@ -1,18 +1,49 @@
version: '3.8'
services:
coolify:
container_name: coolify
build:
context: .
dockerfile: ./docker/prod-ssu/Dockerfile
environment:
AUTORUN_LARAVEL_STORAGE_LINK: "true"
AUTORUN_LARAVEL_MIGRATION: "true"
env_file:
- .env
- APP_ENV=production
- APP_DEBUG
- APP_NAME
- APP_KEY
- APP_URL
- DB_CONNECTION
- DB_HOST
- DB_PORT
- DB_DATABASE
- DB_USERNAME
- DB_PASSWORD
- QUEUE_CONNECTION
- SSL_MODE=off
- AUTORUN_LARAVEL_MIGRATION=true
ports:
- "${APP_PORT:-8000}:80"
depends_on:
postgres:
condition: service_healthy
postgres:
container_name: coolify-db
volumes:
- coolify-db:/var/lib/postgresql/data
environment:
POSTGRES_USER: "${DB_USERNAME}"
POSTGRES_PASSWORD: "${DB_PASSWORD}"
POSTGRES_DB: "${DB_DATABASE}"
env_file:
- .env
healthcheck:
test:
[
"CMD-SHELL",
"pg_isready -U ${DB_USERNAME}",
"-d",
"${DB_DATABASE}"
]
interval: 2s
retries: 5
timeout: 2s
volumes:
coolify-db:
name: coolify-db

View File

@ -6,6 +6,7 @@ services:
- coolify
depends_on:
- postgres
postgres:
image: postgres:15-alpine
networks:

View File

@ -1,8 +1,21 @@
FROM node:19 as static-assets
WORKDIR /app
COPY . .
RUN npm install
RUN npm run build
FROM serversideup/php:8.2-fpm-nginx
WORKDIR /var/www/html
ARG POSTGRES_VERSION=15
RUN apt-get update && apt-get install -y php-pgsql openssh-client
RUN apt-get update && apt-get install -y php-pgsql openssh-client git git-lfs
RUN apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
COPY --chmod=755 docker/dev-ssu/etc/s6-overlay/ /etc/s6-overlay/
COPY --chmod=755 docker/prod-ssu/etc/s6-overlay/ /etc/s6-overlay/
COPY --chown=9999:9999 . .
COPY --from=static-assets --chown=9999:9999 /app/public/build /var/www/html/public/build
RUN composer install --no-dev --optimize-autoloader
RUN php artisan route:cache
RUN php artisan view:cache