-
-
Notifications
You must be signed in to change notification settings - Fork 989
feat: Add Docker support #804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
robbeverhelst
wants to merge
3
commits into
DenverCoder1:main
Choose a base branch
from
robbeverhelst:feat/docker
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,63 @@ | ||
# Use official PHP with Apache | ||
FROM php:8.2-apache | ||
|
||
# Install system dependencies and PHP extensions in one layer | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
git \ | ||
unzip \ | ||
libicu-dev \ | ||
inkscape \ | ||
fonts-dejavu-core \ | ||
curl \ | ||
&& docker-php-ext-configure intl \ | ||
&& docker-php-ext-install intl \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install Composer | ||
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer | ||
robbeverhelst marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Set working directory | ||
WORKDIR /var/www/html | ||
|
||
# Copy composer files and install dependencies | ||
COPY composer.json composer.lock ./ | ||
COPY src/ ./src/ | ||
RUN composer install --no-dev --optimize-autoloader --no-scripts | ||
|
||
# Configure Apache to serve from src/ directory and pass environment variables | ||
RUN a2enmod rewrite headers && \ | ||
echo 'ServerTokens Prod\n\ | ||
ServerSignature Off\n\ | ||
PassEnv TOKEN\n\ | ||
<VirtualHost *:80>\n\ | ||
ServerAdmin webmaster@localhost\n\ | ||
DocumentRoot /var/www/html/src\n\ | ||
<Directory /var/www/html/src>\n\ | ||
Options -Indexes\n\ | ||
AllowOverride None\n\ | ||
Require all granted\n\ | ||
Header always set Access-Control-Allow-Origin "*"\n\ | ||
Header always set Content-Type "image/svg+xml" "expr=%{REQUEST_URI} =~ m#\\.svg$#i"\n\ | ||
Header always set Content-Security-Policy "default-src 'none'; style-src 'unsafe-inline'; img-src data:;" "expr=%{REQUEST_URI} =~ m#\\.svg$#i"\n\ | ||
Header always set Referrer-Policy "no-referrer-when-downgrade"\n\ | ||
Header always set X-Content-Type-Options "nosniff"\n\ | ||
</Directory>\n\ | ||
ErrorLog ${APACHE_LOG_DIR}/error.log\n\ | ||
CustomLog ${APACHE_LOG_DIR}/access.log combined\n\ | ||
</VirtualHost>' > /etc/apache2/sites-available/000-default.conf | ||
|
||
# Set secure permissions | ||
RUN chown -R www-data:www-data /var/www/html && \ | ||
find /var/www/html -type d -exec chmod 755 {} \; && \ | ||
find /var/www/html -type f -exec chmod 644 {} \; | ||
|
||
# Health check | ||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ | ||
CMD curl -f http://localhost/demo/ || exit 1 | ||
|
||
# Expose port | ||
EXPOSE 80 | ||
|
||
# Start Apache | ||
CMD ["apache2-foreground"] |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.