Skip to content

Commit 0c625fb

Browse files
committed
Merge branch 'main' into pr/836
2 parents c1778cd + a936e9b commit 0c625fb

25 files changed

+443
-158
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM mcr.microsoft.com/vscode/devcontainers/base:ubuntu-22.04
1+
FROM mcr.microsoft.com/vscode/devcontainers/base:ubuntu-24.04
22

33
ADD first-run-notice.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt
44

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 4
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
indent_size = 2
14+
15+
[*.{js,css}]
16+
indent_size = 2

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Auto detect text files and perform LF normalization
2-
* text=auto
2+
* text=auto eol=lf

.github/workflows/prettier.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,13 @@ jobs:
2727
if: ${{ github.event_name != 'pull_request' }}
2828
uses: actions/checkout@v3
2929

30+
- name: Setup Node.js
31+
uses: actions/setup-node@v3
32+
with:
33+
node-version: '22'
34+
3035
- name: Install prettier and plugin-php
31-
run: npm install --global prettier@2.8.1 @prettier/plugin-php@0.18.9
36+
run: npm i
3237

3338
- name: Lint with Prettier
3439
continue-on-error: true

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ package-lock.json
1212

1313
# Environment
1414
.env
15+
.php-version
1516
DOCKER_ENV
1617
docker_tag
1718

1819
# IDE
1920
.vscode/
20-
.idea/
21+
.idea/

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
vendor
2+
**/*.min.js
3+
.prettierrc

.prettierrc.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = {
2+
printWidth: 120,
3+
endOfLine: "auto",
4+
plugins: ["@prettier/plugin-php"],
5+
overrides: [
6+
{
7+
files: "*.php",
8+
options: {
9+
parser: "php",
10+
},
11+
},
12+
],
13+
};

Dockerfile

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Use PHP 8.3 (8.4 not supported yet)
2+
FROM php:8.3-apache@sha256:6be4ef702b2dd05352f7e5fe14667696a4ad091c9d2ad9083becbee4300dc3b1
3+
4+
# Install system dependencies and PHP extensions in one layer
5+
RUN apt-get update && apt-get install -y --no-install-recommends \
6+
git \
7+
unzip \
8+
libicu-dev \
9+
inkscape \
10+
fonts-dejavu-core \
11+
curl \
12+
&& docker-php-ext-configure intl \
13+
&& docker-php-ext-install intl \
14+
&& apt-get clean \
15+
&& rm -rf /var/lib/apt/lists/*
16+
17+
# Install Composer
18+
COPY --from=composer/composer:latest-bin@sha256:c9bda63056674836406cacfbbdd8ef770fb4692ac419c967034225213c64e11b /composer /usr/bin/composer
19+
20+
# Set working directory
21+
WORKDIR /var/www/html
22+
23+
# Copy composer files and install dependencies
24+
COPY composer.json composer.lock ./
25+
COPY src/ ./src/
26+
RUN composer install --no-dev --optimize-autoloader --no-scripts
27+
28+
# Configure Apache to serve from src/ directory and pass environment variables
29+
RUN a2enmod rewrite headers && \
30+
echo 'ServerTokens Prod\n\
31+
ServerSignature Off\n\
32+
PassEnv TOKEN\n\
33+
<VirtualHost *:80>\n\
34+
ServerAdmin webmaster@localhost\n\
35+
DocumentRoot /var/www/html/src\n\
36+
<Directory /var/www/html/src>\n\
37+
Options -Indexes\n\
38+
AllowOverride None\n\
39+
Require all granted\n\
40+
Header always set Access-Control-Allow-Origin "*"\n\
41+
Header always set Content-Type "image/svg+xml" "expr=%{REQUEST_URI} =~ m#\\.svg$#i"\n\
42+
Header always set Content-Security-Policy "default-src 'none'; style-src 'unsafe-inline'; img-src data:;" "expr=%{REQUEST_URI} =~ m#\\.svg$#i"\n\
43+
Header always set Referrer-Policy "no-referrer-when-downgrade"\n\
44+
Header always set X-Content-Type-Options "nosniff"\n\
45+
</Directory>\n\
46+
ErrorLog ${APACHE_LOG_DIR}/error.log\n\
47+
CustomLog ${APACHE_LOG_DIR}/access.log combined\n\
48+
</VirtualHost>' > /etc/apache2/sites-available/000-default.conf
49+
50+
# Set secure permissions
51+
RUN chown -R www-data:www-data /var/www/html && \
52+
find /var/www/html -type d -exec chmod 755 {} \; && \
53+
find /var/www/html -type f -exec chmod 644 {} \;
54+
55+
# Health check
56+
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
57+
CMD curl -f http://localhost/demo/ || exit 1
58+
59+
# Expose port
60+
EXPOSE 80
61+
62+
# Start Apache
63+
CMD ["apache2-foreground"]

README.md

Lines changed: 37 additions & 1 deletion
Large diffs are not rendered by default.

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"php -S localhost:8000 -t src"
3232
],
3333
"test": "./vendor/bin/phpunit --testdox tests",
34-
"lint": "prettier --check *.md **/*.{php,md,js,css} !**/*.min.js --print-width 120",
35-
"lint-fix": "prettier --write *.md **/*.{php,md,js,css} !**/*.min.js --print-width 120"
34+
"lint": "npx prettier --check *.md **/*.{php,md,js,css}",
35+
"lint-fix": "npx prettier --write *.md **/*.{php,md,js,css}"
3636
}
3737
}

0 commit comments

Comments
 (0)