Skip to content

Commit

Permalink
chore: use prebuilt image (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin authored Feb 24, 2024
1 parent 2f5a30e commit acbed8e
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 87 deletions.
54 changes: 0 additions & 54 deletions .devcontainer/Dockerfile

This file was deleted.

10 changes: 4 additions & 6 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
{
"name": "PHP & SQLite",
"service": "app",
"workspaceFolder": "/workspace",
"dockerComposeFile": "docker-compose.yml",
"image": "ghcr.io/asbiin/devcontainers/php:8.2",

// For use with PHP or Apache (e.g.php -S localhost:8080 or apache2ctl start)
"forwardPorts": [8080],
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {}
},

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": ".devcontainer/postCreate.sh",
"postStartCommand": ".devcontainer/postStart.sh"

// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
// "remoteUser": "vscode"
}
21 changes: 0 additions & 21 deletions .devcontainer/docker-compose.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .devcontainer/postCreate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ set_apache() {
}

set_database() {
cp $ROOT/.env.example $ROOT/.env && echo "APP_TRUSTED_PROXIES=*" >> $ROOT/.env
cp $ROOT/.env.example $ROOT/.env && echo -e "APP_TRUSTED_PROXIES=*\nAPP_FORCE_URL=true" >> $ROOT/.env
setenv "DB_CONNECTION" "sqlite"
setenv "DB_DATABASE" "$ROOT/$DATABASE"
touch $ROOT/$DATABASE && chgrp www-data $ROOT/$DATABASE && chmod g+w $ROOT/$DATABASE
Expand Down
8 changes: 8 additions & 0 deletions app/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\Str;

class RouteServiceProvider extends ServiceProvider
{
Expand All @@ -24,6 +27,11 @@ class RouteServiceProvider extends ServiceProvider
*/
public function boot(): void
{
if (Config::get('app.force_url')) {
URL::forceRootUrl(Str::of(config('app.url'))->ltrim('/'));
URL::forceScheme('https');
}

RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
});
Expand Down
2 changes: 2 additions & 0 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@

'asset_url' => env('ASSET_URL'),

'force_url' => (bool) env('APP_FORCE_URL', false),

/*
|--------------------------------------------------------------------------
| Application Timezone
Expand Down
1 change: 1 addition & 0 deletions resources/css/app.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import 'charts.css';
@tailwind base;
@tailwind components;
@tailwind utilities;
Expand Down
2 changes: 1 addition & 1 deletion resources/js/app.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import './bootstrap';
import '../css/app.css';

import Alpine from 'alpinejs';
import Clipboard from "@ryangjchandler/alpine-clipboard";
import htmx from 'htmx.org';
import 'charts.css';

window.Alpine = Alpine;
window.htmx = htmx;
Expand Down
2 changes: 1 addition & 1 deletion resources/views/layouts/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>⛺</text></svg>">

<!-- Scripts -->
@vite(['resources/css/app.css', 'resources/js/app.js'])
@vite('resources/js/app.js')
</head>

<body class="font-sans antialiased text-slate-900 dark:text-gray-100">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/layouts/guest.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<title>{{ config('app.name', 'Laravel') }}</title>

<!-- Scripts -->
@vite(['resources/css/app.css', 'resources/js/app.js'])
@vite('resources/js/app.js')

{{ $jsonLdSchema ?? '' }}

Expand Down
2 changes: 1 addition & 1 deletion resources/views/layouts/login.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<title>{{ config('app.name', 'Laravel') }}</title>

<!-- Scripts -->
@vite(['resources/css/app.css', 'resources/js/app.js'])
@vite('resources/js/app.js')

{{ $jsonLdSchema ?? '' }}

Expand Down
5 changes: 4 additions & 1 deletion vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ export default defineConfig(({ mode }) => {
return {
plugins: [
laravel({
input: ['resources/css/app.css', 'resources/js/app.js'],
input: [
'resources/css/app.css',
'resources/js/app.js'
],
refresh: true,
}),
basicSsl(),
Expand Down

0 comments on commit acbed8e

Please sign in to comment.