Daniel hace 2 años
padre
commit
7774d25f40
Se han modificado 12 ficheros con 184 adiciones y 1 borrados
  1. +53
    -0
      .docker/Dockerfile
  2. +40
    -0
      .docker/docker-compose.yml
  3. +13
    -0
      .docker/init.sh
  4. +8
    -0
      .idea/.gitignore
  5. +8
    -0
      .idea/WebServerSkeleton.iml
  6. +4
    -0
      .idea/encodings.xml
  7. +8
    -0
      .idea/modules.xml
  8. +19
    -0
      .idea/php.xml
  9. +28
    -1
      README.md
  10. +0
    -0
      logs/tbserver-cron-log.txt
  11. +0
    -0
      logs/tbserver-log.txt
  12. +3
    -0
      public/index.php

+ 53
- 0
.docker/Dockerfile Ver fichero

@@ -0,0 +1,53 @@
FROM php:8.1-apache

ENV APACHE_DOCUMENT_ROOT /var/www/html/public
ENV APACHE_SERVER_NAME localhost
ENV PATH="$PATH"
WORKDIR /var/www/html

RUN apt-get update

RUN apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
libicu-dev \
&& docker-php-ext-install -j$(nproc) iconv \
&& docker-php-ext-configure gd --with-jpeg=/usr/include/ --with-freetype=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd \
&& docker-php-ext-install -j$(nproc) intl \
&& docker-php-ext-install -j$(nproc) pdo_mysql

RUN apt-get install -y git zip

RUN apt install nano

RUN pecl install xdebug-3.1.5 \
&& docker-php-ext-enable xdebug \
&& echo "xdebug.mode=debug" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.client_host = host.docker.internal" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.start_with_request=yes" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo 'xdebug.discover_client_host=1' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo 'xdebug.log=/var/www/var/log/xdebug.log' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo 'xdebug.log_level=0' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini

RUN a2enmod rewrite && a2enmod headers
RUN a2ensite 000-default

COPY ./ /var/www/html

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


RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"

RUN chown -R www-data:www-data /var/www/html/

COPY /init.sh /init.sh
RUN chmod 755 /init.sh
RUN chmod +x /init.sh
EXPOSE 80

ENTRYPOINT ["/init.sh"]
CMD ["apache2-foreground"]

+ 40
- 0
.docker/docker-compose.yml Ver fichero

@@ -0,0 +1,40 @@
version: '3.7'

services:
database:
image: mariadb
container_name: skeleton-mariadb
ports:
- "3401:3306"
environment:
# think about .env file here
MYSQL_ROOT_PASSWORD: root
volumes:
- ./../.db:/var/lib/mysql
restart: always
networks:
- default
php:
build:
context: ./
dockerfile: Dockerfile
image: 'skeleton_php'
container_name: skeleton-php
ports:
- '8101:80'
volumes:
- ./../:/var/www/html
networks:
- default
phpmyadmin:
image: phpmyadmin
container_name: skeleton-phpmyadmin
restart: always
ports:
- "8102:80"
environment:
- PMA_ARBITRARY=1
networks:
- default
networks:
default:

+ 13
- 0
.docker/init.sh Ver fichero

@@ -0,0 +1,13 @@
#!/bin/sh

echo "create log files"

su www-data -s /bin/bash
mkdir /var/www/html/temp
mkdir /var/www/html/logs
cd /var/www/html/logs
touch tbserver-log.txt
touch tbserver-cron-log.txt

echo "$@"
docker-php-entrypoint "$@"

+ 8
- 0
.idea/.gitignore Ver fichero

@@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

+ 8
- 0
.idea/WebServerSkeleton.iml Ver fichero

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

+ 4
- 0
.idea/encodings.xml Ver fichero

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
</project>

+ 8
- 0
.idea/modules.xml Ver fichero

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/WebServerSkeleton.iml" filepath="$PROJECT_DIR$/.idea/WebServerSkeleton.iml" />
</modules>
</component>
</project>

+ 19
- 0
.idea/php.xml Ver fichero

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MessDetectorOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCSFixerOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCodeSnifferOptionsConfiguration">
<option name="highlightLevel" value="WARNING" />
<option name="transferred" value="true" />
</component>
<component name="PhpStanOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PsalmOptionsConfiguration">
<option name="transferred" value="true" />
</component>
</project>

+ 28
- 1
README.md Ver fichero

@@ -1,2 +1,29 @@
# web-server-skeleton
# contao-docker-test

#Installation:

# Some important information

# Some helpful docker commands:
- `docker-compose up -d`
- `docker-compose down`
- `docker exec -it tb-con-tbuddy /bin/bash`
- `docker build -t tb-con-tbuddy .`
- `docker image rm tb_spt_image`
- `docker ps`
- `docker ps --all`
- `docker container stop $(docker container ls -aq)`
- `docker container rm $(docker container ls -aq)`
- `docker rmi $(docker images -q)`
- `docker stop spt_tbuddy && docker rm spt_tbuddy && docker rmi spt_tb && docker-compose up -d`

# Some helpful other commands:
- Restart Apache within the container
- Go into docker container `docker exec -it spt_tbuddy /bin/bash`
- Apache restart `sudo /etc/init.d/apache2 reload`

# Clean restart of Docker instance
1. Stop the container(s) using the following command: `docker-compose down`
2. Delete all containers using the following command: `docker rm -f $(docker ps -a -q)`
3. Delete all volumes using the following command: `docker volume rm $(docker volume ls -q)`
4. Restart the containers using the following command: `docker-compose up -d`

+ 0
- 0
logs/tbserver-cron-log.txt Ver fichero


+ 0
- 0
logs/tbserver-log.txt Ver fichero


+ 3
- 0
public/index.php Ver fichero

@@ -0,0 +1,3 @@
<?php echo 'du bist geil flo' ?>
<?php phpinfo() ?>
<div>hello</div>

Cargando…
Cancelar
Guardar