Skip to content

Commit 59633de

Browse files
author
Rafael Dias
committed
Create Docker structure
1 parent 3aa553f commit 59633de

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

Dockerfile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
FROM php:7.3-fpm
2+
3+
ARG COMPOSER_ARGS=""
4+
5+
RUN apt-get update \
6+
&& apt-get install -y \
7+
zip \
8+
unzip \
9+
autoconf \
10+
libzip-dev \
11+
git \
12+
libmcrypt-dev \
13+
mysql-client \
14+
&& docker-php-ext-install mbstring pdo_mysql \
15+
&& cp /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime \
16+
&& echo "America/Sao_Paulo" | tee /etc/TZ /etc/timezone
17+
18+
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
19+
20+
WORKDIR /app
21+
22+
COPY composer.json composer.lock ./
23+
24+
RUN composer install \
25+
--no-interaction \
26+
--no-scripts \
27+
--no-autoloader \
28+
--no-progress ${COMPOSER_ARGS}
29+
30+
COPY . .
31+
32+
RUN chown -R www-data:www-data ./ && chmod -R 775 storage
33+
RUN composer dump-autoload --optimize

docker-compose.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
version: '3'
2+
3+
services:
4+
api:
5+
build: .
6+
restart: on-failure
7+
command: php -S 0.0.0.0:80 -t public
8+
volumes:
9+
- ./:/app
10+
ports:
11+
- 80:80
12+
networks:
13+
default:
14+
aliases:
15+
- api.users.local
16+
17+
database:
18+
image: mysql:8.0
19+
command: --default-authentication-plugin=mysql_native_password
20+
restart: on-failure
21+
ports:
22+
- 3306:3306
23+
env_file:
24+
- .env
25+
environment:
26+
MYSQL_USER: $${DB_USERNAME}
27+
MYSQL_PASSWORD: $${DB_PASSWORD}
28+
MYSQL_DATABASE: $${DB_DATABASE}
29+
MYSQL_ROOT_PASSWORD: $${DB_PASSWORD}
30+
TZ: America/Sao_Paulo
31+
volumes:
32+
- ./database/fixtures:/docker-entrypoint-initdb.d

0 commit comments

Comments
 (0)