-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
184 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
bootstrap/cache/services.php | ||
bootstrap/cache/* | ||
|
||
storage/app/* | ||
storage/framework/cache/* | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
eyJpdiI6IjM4ckdUdk1XazMxQjA4RnpTRUZhc3c9PSIsInZhbHVlIjoib1Q3UWtxdzdjSytwMGVRMW9MT2lERlVxclpTK05mUDk1dlhJd2NwbmtkRnFWZTExV2NZdEROMG8zb2N5ZEN1MW5tMk5JbHMxdDh4Z0NsSzYvdy9TdWNKQ3hBMVhncVMxZkFiSkJLR2VZa0JRMUZYbnF0YXJya0NsN2UwemVkMGpnaUw5Y1Z6enBtcnBPWkR3MW1mRENnU2cvcm9rSXNLMzllV3I0QitKL0xvR0J4MHhhWCtMZERYd3pNeHJiMnBINW42a1dCWkVBNmRhTU14T3FvVzgrMjh3ODd3LzMxcnUzcmRWTjZ2OW1qMis2dkVvRWtINlBmN3YzSXR4Mm12VnJFeGZyckdtL3dwQnhvRWIrTEl0WFJNU2ZEbE5pOTJEaW9LOHlLZ0ZEMjlYdTBBakJma3NvRDdidUZ0bVRkWnZUVmtCVG1oTFBZZEVOa0xyNVdnTExzdGxNL3JLcjJOQ2VqTEh4VGV0LzBJMm5WNm5VWlVRMU50bng3UzhkVnVzVkNGWWtYYTBjS1VEbXNLMk02RHhoQnFUbWVZZGREOEhPQURpejhBY3IwVHlGNGs5THZraUZ2NTZxdTB5L095bFk1d25Za3JiNU1mSUU1YUlMV0VHZzRNVVJOa0dQRXFjM3MvY0ZJSEh2eDZITFMrbDFzV1JaaUFHRWcrV1Fjb0lEVWNKaEFIVFAya1I2RUZZZi9odS82OVZmSTNhek40L2dub2IrYlkvM29rd01uRytiZEVJQ3cwaTZoaHRUeXNDTVEzd0hiTVNsc2NzMWRhOUJpSUJFQjg3dlRkdHE4WTkvdmVudFZ2YjZtY1Ryd1dNWjZ5SGxWZkhMeEhFR2MycSIsIm1hYyI6ImFiZTIyM2NkOTYxYmNkNDA4ZWViZWVlOGIyY2IzNGEwMGFlOGQ4NGM1MGYwNDY2ZWE4ODY5YjllN2ZiOWUxZTgiLCJ0YWciOiIifQ== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Illuminate\Support\Facades\DB; | ||
|
||
class CreateDbSchema extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'app:create-db-schema'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Command description'; | ||
|
||
/** | ||
* Execute the console command. | ||
*/ | ||
public function handle() | ||
{ | ||
$conn = DB::connectUsing("pgsql", [ | ||
...config('database.connections.pgsql'), | ||
'search_path' => "public", | ||
]); | ||
|
||
$search_path = config('database.connections.pgsql.search_path'); | ||
$conn->statement("CREATE SCHEMA IF NOT EXISTS $search_path"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# dependencies | ||
FROM composer:2 AS dependencies | ||
WORKDIR /app | ||
|
||
COPY composer.json composer.lock artisan ./ | ||
COPY app/ ./app/ | ||
COPY bootstrap/ ./bootstrap/ | ||
COPY config/ ./config/ | ||
COPY database/ ./database/ | ||
COPY resources/ ./resources/ | ||
COPY routes/ ./routes/ | ||
|
||
RUN composer install --no-interaction | ||
|
||
# migrate | ||
FROM composer:2 AS migrate | ||
WORKDIR /app | ||
|
||
RUN install-php-extensions pdo_pgsql pgsql redis iconv zip | ||
|
||
COPY --from=dependencies /app ./ | ||
|
||
ARG LARAVEL_ENV=production | ||
ARG LARAVEL_ENV_FILE=.env.${LARAVEL_ENV} | ||
ARG LARAVEL_ENV_FILE_KEY="" | ||
|
||
ENV APP_ENV=${LARAVEL_ENV} | ||
|
||
COPY --chown=nobody ${LARAVEL_ENV_FILE} ./.env.${LARAVEL_ENV} | ||
RUN [ -z "${LARAVEL_ENV_FILE_KEY}" ] || ( mv .env.${LARAVEL_ENV} .env.${LARAVEL_ENV}.encrypted && php artisan env:decrypt -n --env=${LARAVEL_ENV} --key=${LARAVEL_ENV_FILE_KEY} ) | ||
|
||
COPY public/ ./public/ | ||
COPY storage/ ./storage/ | ||
|
||
CMD [ "php", "artisan", "migrate", "-n"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# dev-dependencies | ||
FROM composer:2 AS dev-dependencies | ||
WORKDIR /app | ||
|
||
COPY composer.json composer.lock ./ | ||
RUN composer install --no-interaction --no-autoloader | ||
|
||
# assets-build | ||
FROM node:20-alpine AS assets-build | ||
WORKDIR /app | ||
|
||
COPY package.json package-lock.json ./ | ||
RUN npm install | ||
|
||
COPY ./resources/ ./resources | ||
COPY ./vite.config.ts ./tsconfig.json ./tsconfig.app.json ./tsconfig.node.json ./tailwind.config.js ./postcss.config.js ./ | ||
COPY --from=dev-dependencies /app/vendor ./vendor | ||
|
||
RUN npm run build | ||
|
||
# laravel-build | ||
FROM composer:2 AS laravel-build | ||
WORKDIR /app | ||
|
||
COPY composer.json composer.lock artisan ./ | ||
COPY app/ ./app/ | ||
COPY bootstrap/ ./bootstrap/ | ||
COPY config/ ./config/ | ||
COPY database/ ./database/ | ||
COPY resources/ ./resources/ | ||
COPY routes/ ./routes/ | ||
|
||
RUN composer install --no-interaction --optimize-autoloader --no-dev --prefer-dist | ||
|
||
# deploy | ||
FROM trafex/php-nginx:3.6.0 AS deploy | ||
WORKDIR /var/www/html | ||
|
||
USER root | ||
RUN apk add --no-cache php83-pdo_pgsql php83-pgsql php83-pecl-redis php83-iconv php83-zip | ||
|
||
## Install supercronic (cron alternative) | ||
ENV SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.2.26/supercronic-linux-amd64 \ | ||
SUPERCRONIC=supercronic-linux-amd64 \ | ||
SUPERCRONIC_SHA1SUM=7a79496cf8ad899b99a719355d4db27422396735 | ||
|
||
RUN curl -fsSLO "$SUPERCRONIC_URL" \ | ||
&& echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \ | ||
&& chmod +x "$SUPERCRONIC" \ | ||
&& mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \ | ||
&& ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic | ||
|
||
COPY ./etc/nginx/default.conf /etc/nginx/conf.d/default.conf | ||
COPY ./etc/php/php.ini ${PHP_INI_DIR}/conf.d/php.ini | ||
COPY --chown=nobody ./etc/crontab ./crontab | ||
COPY --chown=nobody ./etc/supervisord.conf ./supervisord.conf | ||
RUN cat ./supervisord.conf >> /etc/supervisor/conf.d/supervisord.conf | ||
RUN rm ./supervisord.conf | ||
|
||
USER nobody | ||
|
||
ARG LARAVEL_ENV=production | ||
ARG LARAVEL_ENV_FILE=.env.${LARAVEL_ENV} | ||
ARG LARAVEL_ENV_FILE_KEY="" | ||
|
||
COPY --chown=nobody ${LARAVEL_ENV_FILE} ./.env.${LARAVEL_ENV} | ||
COPY --chown=nobody public/ ./public/ | ||
COPY --chown=nobody storage/ ./storage/ | ||
COPY --chown=nobody --from=laravel-build /app/ ./ | ||
COPY --chown=nobody --from=assets-build /app/public/ ./public/ | ||
|
||
ENV APP_ENV=${LARAVEL_ENV} | ||
|
||
RUN [ -z "${LARAVEL_ENV_FILE_KEY}" ] || ( mv .env.${LARAVEL_ENV} .env.${LARAVEL_ENV}.encrypted && php artisan env:decrypt -n --env=${LARAVEL_ENV} --key=${LARAVEL_ENV_FILE_KEY} ) | ||
RUN php artisan storage:link -n | ||
RUN php artisan event:cache -n | ||
RUN php artisan route:cache -n | ||
RUN php artisan view:cache -n | ||
|
||
COPY --chown=nobody ./etc/entrypoint.sh /entrypoint.sh | ||
CMD [ "/entrypoint.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
# Cache config and other stuff | ||
php artisan optimize -n | ||
rm .env.${LARAVEL_ENV}* | ||
|
||
/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
{ | ||
"$schema": "https://railway.app/railway.schema.json", | ||
"build": { | ||
"builder": "NIXPACKS" | ||
"builder": "DOCKERFILE", | ||
"dockerfilePath": "./dockerfiles/Dockerfile.seeder" | ||
}, | ||
"deploy": { | ||
"startCommand": "php artisan migrate --force --seed --no-interaction --isolated --database=pgsql" | ||
"restartPolicyType": "NEVER", | ||
"sleepApplication": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
{ | ||
"$schema": "https://railway.app/railway.schema.json", | ||
"build": { | ||
"builder": "NIXPACKS" | ||
"builder": "DOCKERFILE", | ||
"dockerfilePath": "./dockerfiles/Dockerfile.website" | ||
}, | ||
"deploy": { | ||
"sleepApplication": true, | ||
"startCommand": "php artisan serve" | ||
"sleepApplication": true | ||
} | ||
} |