forked from osmbe/osm-welcome-tool
-
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.
* Create Dockerfile * Create .dockerignore * Create composer.sh * Create apache.conf * Update INSTALL.md * Create docker.yml * Update docker.yml * Rename apache.conf to apache/app.conf * Update INSTALL.md * Update Dockerfile * Update INSTALL.md * Create welcome-update.sh * Update Dockerfile
- Loading branch information
Showing
7 changed files
with
206 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<VirtualHost *:80> | ||
# The ServerName directive sets the request scheme, hostname and port that | ||
# the server uses to identify itself. This is used when creating | ||
# redirection URLs. In the context of virtual hosts, the ServerName | ||
# specifies what hostname must appear in the request's Host: header to | ||
# match this virtual host. For the default virtual host (this file) this | ||
# value is not decisive as it is used as a last resort host regardless. | ||
# However, you must set it for any further virtual host explicitly. | ||
#ServerName www.example.com | ||
|
||
ServerAdmin webmaster@localhost | ||
DocumentRoot /var/www/app/public | ||
|
||
<Directory "/var/www/app/public"> | ||
Require all granted | ||
AllowOverride All | ||
</Directory> | ||
|
||
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn, | ||
# error, crit, alert, emerg. | ||
# It is also possible to configure the loglevel for particular | ||
# modules, e.g. | ||
#LogLevel info ssl:warn | ||
|
||
ErrorLog ${APACHE_LOG_DIR}/error.log | ||
CustomLog ${APACHE_LOG_DIR}/access.log combined | ||
|
||
# For most configuration files from conf-available/, which are | ||
# enabled or disabled at a global level, it is possible to | ||
# include a line for only one particular virtual host. For example the | ||
# following line enables the CGI configuration for this host only | ||
# after it has been globally disabled with "a2disconf". | ||
#Include conf-available/serve-cgi-bin.conf | ||
</VirtualHost> |
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,17 @@ | ||
#!/bin/sh | ||
|
||
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')" | ||
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | ||
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" | ||
|
||
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ] | ||
then | ||
>&2 echo 'ERROR: Invalid installer checksum' | ||
rm composer-setup.php | ||
exit 1 | ||
fi | ||
|
||
php composer-setup.php --quiet | ||
RESULT=$? | ||
rm composer-setup.php | ||
exit $RESULT |
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,4 @@ | ||
#!/bin/sh | ||
|
||
cd /var/www/osm-welcome-tool/ | ||
php bin/console welcome:update |
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,7 @@ | ||
.github/ | ||
docs/ | ||
node_modules/ | ||
public/build/ | ||
var/ | ||
vendor/ | ||
.env.* |
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,44 @@ | ||
name: Docker Image CI | ||
|
||
on: | ||
push: | ||
branches: [ 2.x ] | ||
pull_request: | ||
branches: [ 2.x ] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
|
||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v2 | ||
if: github.event_name != 'pull_request' | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} |
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,85 @@ | ||
# Node.js (Build assets) | ||
|
||
FROM node:16-alpine as node | ||
|
||
WORKDIR /assets | ||
|
||
COPY . . | ||
|
||
RUN npm install | ||
RUN npm run build | ||
|
||
# Composer | ||
|
||
FROM composer:2 as composer | ||
|
||
# Application | ||
|
||
FROM php:8.1-apache as app | ||
|
||
## Install PHP dependencies | ||
|
||
RUN apt-get update -y && apt-get upgrade -y | ||
RUN apt-get install -y libicu-dev libpq-dev libsodium-dev libzip-dev | ||
|
||
RUN docker-php-ext-configure zip; | ||
RUN docker-php-ext-install -j$(nproc) intl pdo_pgsql sodium zip | ||
|
||
## Install Symfony CLI | ||
|
||
# RUN apk add --no-cache bash | ||
# RUN curl -1sLf 'https://dl.cloudsmith.io/public/symfony/stable/setup.alpine.sh' | bash | ||
# RUN apk add symfony-cli | ||
|
||
## Configure Apache | ||
|
||
COPY ".docker/apache/app.conf" "/etc/apache2/sites-available/" | ||
|
||
RUN a2enmod rewrite alias | ||
RUN a2dissite 000-default | ||
RUN a2ensite app | ||
RUN apache2ctl restart | ||
|
||
## Copy/Clean files | ||
|
||
ENV APP_ENV=prod | ||
# ENV APP_ENV=dev | ||
|
||
WORKDIR "/var/www/app" | ||
|
||
COPY --chown=www-data . . | ||
COPY .docker/cron.daily/welcome-update.sh /etc/cron.daily/welcome-update | ||
|
||
RUN rm -Rf .docker/ | ||
RUN rm -Rf assets/ | ||
|
||
COPY --from=node --chown=www-data "/assets/public/build" "./public/build" | ||
|
||
## Install Composer & Dependencies | ||
|
||
COPY --from=composer "/usr/bin/composer" "/usr/bin/composer" | ||
|
||
ENV COMPOSER_ALLOW_SUPERUSER=1 | ||
|
||
RUN composer validate | ||
RUN composer install --no-ansi --no-interaction --no-progress --prefer-dist --optimize-autoloader --no-scripts --no-dev | ||
# RUN composer install --no-ansi --no-interaction --no-progress --prefer-dist --optimize-autoloader --no-scripts | ||
RUN composer clear-cache | ||
RUN composer dump-env prod | ||
RUN composer run-script post-install-cmd --no-dev | ||
# RUN composer run-script post-install-cmd | ||
RUN chmod +x bin/console; sync; | ||
|
||
###> recipes ### | ||
###< recipes ### | ||
|
||
## Check Symfony requirements | ||
|
||
# RUN symfony check:requirements | ||
|
||
## Finalize | ||
|
||
RUN mkdir -p var/cache/${APP_ENV} var/log/ | ||
RUN chown -R www-data:www-data var/ | ||
|
||
EXPOSE 80 |
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