removido
(usa Nenhuma)
Enviado em 17/12/2019 - 20:28h
Tenho um Dockerfile que criei para usar em uma empresa, mas ao invés de apache utilizei o nginx:
FROM debian:buster
MAINTAINER Ruan Klein
# Update package list
RUN apt-get update
# Install NGINX and PHP
RUN apt-get install -y nginx php7.3-fpm
# Configure mariadb
ENV DEBIAN_FRONTEND noninteractive
RUN echo "mariadb-server-10.3 mysql-server/root_password password ''" | debconf-set-selections
RUN echo "mariadb-server-10.3 mysql-server/root_password_again password ''" | debconf-set-selections
# Install MariaDB and PHP Mysql module
RUN apt-get install -y mariadb-server php7.3-mysql
# Clear apt cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Configs
COPY nginx-default /etc/nginx/sites-available/default
COPY start.sh /usr/local/bin
# Start
CMD start.sh
Conteúdo do nginx-default:
server {
listen 80;
root /var/www/app/public;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
#try_files $uri =404;
try_files $uri /index.php =404;
#fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Conteúdo do start.sh:
#!/usr/bin/env bash
# Start all services
for service in nginx mysql php7.3-fpm; do service $service start; done
if [ ! -f /.started ]; then
# Create a user for mysql and database application
mysql -uroot <<EOF
create database app;
create user 'app'@'localhost' identified by '';
grant all privileges on *.* to 'app'@'localhost'
with grant option;
create user 'app'@'%' identified by '';
grant all privileges on *.* to 'app'@'%'
with grant option;
flush privileges;
EOF
# Permission
sed -i 's/127.0.0.1$/0.0.0.0/' /etc/mysql/mariadb.conf.d/50-server.cnf
# Restart MySql
service mysql restart
touch /.started
fi
/bin/bash
Tu pode pegar e alterar para usar as versões necessárias...
Outra opção é o Laradock, que permite escolher a versão de cada componente.