Skip to content

Commit 5714131

Browse files
docker
1 parent ffa3497 commit 5714131

4 files changed

Lines changed: 136 additions & 0 deletions

File tree

Dockerfile

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
FROM php:8.3-apache
2+
3+
# packages
4+
RUN sed -i 's|main|main non-free|' /etc/apt/sources.list.d/debian.sources && apt-get update && apt-get install -y \
5+
unixodbc \
6+
unixodbc-dev \
7+
freetds-bin \
8+
freetds-dev \
9+
libicu-dev \
10+
git \
11+
unzip \
12+
libzip-dev \
13+
libpng-dev \
14+
libonig-dev \
15+
libxml2-dev \
16+
libjpeg-dev \
17+
libpng-dev \
18+
libfreetype6-dev \
19+
curl
20+
21+
# cleanup
22+
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
23+
24+
# composer
25+
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
26+
27+
# php libs
28+
RUN docker-php-ext-install \
29+
intl \
30+
pdo_mysql \
31+
soap \
32+
zip \
33+
mbstring \
34+
bcmath \
35+
pdo_dblib
36+
37+
# gd
38+
RUN docker-php-ext-configure gd --with-freetype --with-jpeg && \
39+
docker-php-ext-install gd
40+
41+
# php memory
42+
ENV PHP_MEMORY_LIMIT=512M
43+
ENV PHP_UPLOAD_LIMIT=512M
44+
RUN { \
45+
echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \
46+
echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \
47+
echo 'post_max_size=${PHP_UPLOAD_LIMIT}'; \
48+
} > "${PHP_INI_DIR}/conf.d/upload.ini"
49+
50+
# apache
51+
RUN a2enmod rewrite
52+
RUN sed -i 's|/var/www/html|/var/www/html/public|' /etc/apache2/sites-available/000-default.conf
53+
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
54+
55+
# composer
56+
USER www-data
57+
COPY --chown=www-data . .
58+
RUN composer install --optimize-autoloader --no-interaction
59+
60+
CMD ["./serve.sh"]

docker-compose.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
services:
2+
salas:
3+
image: salas
4+
container_name: salas
5+
ports:
6+
- "8000:80"
7+
depends_on:
8+
- mariadb
9+
- selenium
10+
networks:
11+
- salas-network
12+
volumes:
13+
- ./:/var/www/html
14+
- storage_data:/var/www/html/storage
15+
- cache_data:/var/www/html/bootstrap/cache
16+
17+
mariadb:
18+
image: mariadb:11
19+
container_name: salas_mariadb
20+
restart: always
21+
environment:
22+
MYSQL_DATABASE: salas
23+
MYSQL_USER: salas
24+
MYSQL_PASSWORD: salas
25+
MYSQL_ROOT_PASSWORD: salas
26+
volumes:
27+
- mariadb_data:/var/lib/mysql
28+
networks:
29+
- salas-network
30+
31+
# http://localhost:7900 senha: secret
32+
selenium:
33+
image: selenium/standalone-chrome:latest
34+
container_name: salas_selenium
35+
ports:
36+
- "4444:4444" # WebDriver
37+
- "7900:7900" # VNC (ver browser)
38+
shm_size: 2gb
39+
networks:
40+
- salas-network
41+
42+
networks:
43+
salas-network:
44+
45+
volumes:
46+
mariadb_data:
47+
storage_data:
48+
cache_data:

readme.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,3 +221,23 @@ No diretório app/Helpers foi criado uma Trait UspdevDuskTrait.php que criar um
221221

222222
...
223223

224+
Criando imagem:
225+
226+
docker build --no-cache -t salas .
227+
228+
Ambiente dev:
229+
230+
docker compose up
231+
232+
Comandos do laravel dentro do container:
233+
234+
cp .env.example .env
235+
docker exec -u root -it salas composer install
236+
docker exec -u root -it salas php artisan key:generate
237+
docker exec -u root -it salas php artisan migrate
238+
239+
Acessando os containers via ssh:
240+
241+
docker compose exec -u root salas bash
242+
docker compose exec -u root mariadb bash
243+

serve.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#! /bin/bash
2+
3+
# Comandos laravel
4+
php artisan key:generate
5+
php artisan optimize:clear
6+
7+
# Necessário para php:8.3-apache
8+
exec apache2-foreground

0 commit comments

Comments
 (0)