Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create docker container for testing (#438)
* Create docker container for testing * Create docker container for testing * Apply fixes from StyleCI Co-authored-by: StyleCI Bot <bot@styleci.io>
- Loading branch information
1 parent
aab46bf
commit cf2cbfe
Showing
9 changed files
with
2,184 additions
and
8 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 |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# | ||
# Base install | ||
# | ||
FROM amd64/php:8.0-apache as base | ||
|
||
LABEL vendor="L5 Swagger" | ||
|
||
# Arguments defined in docker-compose.yml | ||
ARG user | ||
ARG uid | ||
|
||
# Set common env variables | ||
ENV TZ="UTC" | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
git \ | ||
curl \ | ||
libpng-dev \ | ||
libonig-dev \ | ||
libxml2-dev \ | ||
zip \ | ||
unzip memcached libmemcached-dev libmemcached-tools nano | ||
|
||
# Clear cache | ||
RUN apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
RUN pecl install memcached | ||
|
||
RUN pecl install -f xdebug \ | ||
&& docker-php-ext-enable xdebug | ||
|
||
RUN a2enmod rewrite | ||
|
||
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer | ||
|
||
COPY --chown=root:root docker/php/php.ini /usr/local/etc/php/php.ini | ||
COPY --chown=root:root docker/apache/000-default.conf /etc/apache2/sites-available/000-default.conf | ||
COPY --chown=www-data:www-data . /app | ||
|
||
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf | ||
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf | ||
|
||
# Create system user to run Composer and Artisan Commands | ||
RUN useradd -G www-data,root -u $uid -d /home/$user $user | ||
RUN mkdir -p /home/$user/.composer && \ | ||
chown -R $user:$user /home/$user | ||
|
||
RUN chown -R $user:$user /app | ||
|
||
WORKDIR /app | ||
|
||
USER $user | ||
RUN alias composer='/usr/local/bin/php -dxdebug.mode=off /usr/local/bin/composer' | ||
|
||
RUN /usr/local/bin/php -dxdebug.mode=off /usr/local/bin/composer install --prefer-dist -vvv | ||
|
||
RUN /usr/local/bin/php -dxdebug.mode=off /usr/local/bin/composer create-project laravel/laravel l5-swagger-app --no-interaction | ||
|
||
WORKDIR /app/l5-swagger-app | ||
|
||
RUN /usr/local/bin/php -dxdebug.mode=off /usr/local/bin/composer config repositories.l5-swagger path '../' | ||
|
||
RUN /usr/local/bin/php -dxdebug.mode=off /usr/local/bin/composer require 'DarkaOnLine/l5-swagger:dev-master' | ||
|
||
RUN ln -s /app/tests/storage/annotations/ app/annotations | ||
|
||
RUN chown -R $user:$user . | ||
# | ||
# Build dev stuff | ||
# | ||
FROM base as local | ||
|
||
ENV PHP_IDE_CONFIG="serverName=l5-swagger" | ||
ENV APP_ENV="local" | ||
ENV APACHE_DOCUMENT_ROOT="/app/l5-swagger-app/public" | ||
ENV L5_SWAGGER_GENERATE_ALWAYS="true" |
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,26 @@ | ||
version: '3.9' | ||
|
||
services: | ||
l5-swagger-app: | ||
image: l5-swagger-app | ||
container_name: l5-swagger-app | ||
restart: "no" | ||
build: | ||
args: | ||
user: l5-swagger | ||
uid: 1000 | ||
context: ./ | ||
dockerfile: Dockerfile | ||
target: local | ||
volumes: | ||
- l5-swagger-app-volume:/app/l5-swagger-app:rw | ||
- ./:/app:rw | ||
ports: | ||
- "7777:80" | ||
|
||
volumes: | ||
l5-swagger-app-volume: | ||
|
||
networks: | ||
default: | ||
name: l5-swagger-app |
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 ${APACHE_DOCUMENT_ROOT} | ||
|
||
RewriteEngine on | ||
RewriteCond %{REQUEST_FILENAME} !-f | ||
RewriteCond %{REQUEST_FILENAME} !-d | ||
RewriteRule ^.*$ /index.php [L] | ||
|
||
# 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> |
Oops, something went wrong.