Initial Commit

main
Alex 2 years ago
parent 1a74d0d3b3
commit a192de501a

2
.gitignore vendored

@ -23,3 +23,5 @@ Homestead.json
/.vagrant
.phpunit.result.cache
# src Ordner mit Laravel Intallations Files
src/

@ -0,0 +1,137 @@
version: '3'
networks:
rauru_net:
volumes:
local_pgdata_rauru:
pgadmin-data:
services:
app:
container_name: rauru_app
build:
context: ./dockerfiles
dockerfile: nginx.dockerfile
args:
- UID=${UID:-1000}
- GID=${GID:-1000}
ports:
- "80:80"
volumes:
- ./src:/var/www/html:delegated
depends_on:
- php
- redis
- db
- mailhog
- pgadmin
networks:
- rauru_net
db:
image: postgres
container_name: rauru_db
ports:
- "5432:5432"
environment:
POSTGRES_DB: rauru_db
POSTGRES_USER: rauru_user
POSTGRES_PASSWORD: secret
volumes:
- local_pgdata_rauru:/var/lib/postgresql/data
#- ./rauru_pgdata:/var/lib/postgresql/data
networks:
- rauru_net
pgadmin:
image: dpage/pgadmin4
container_name: rauru_pgAdmin
ports:
- "5050:80"
depends_on:
- db
environment:
PGADMIN_DEFAULT_EMAIL: admin@example.de
PGADMIN_DEFAULT_PASSWORD: secret
volumes:
- pgadmin-data:/var/lib/pgadmin
#- ./pgadmindata:/var/lib/pgadmin
networks:
- rauru_net
php:
build:
context: ./dockerfiles
dockerfile: php.root.dockerfile
args:
- UID=${UID:-1000}
- GID=${GID:-1000}
container_name: rauru_php
ports:
- "9000:9000"
volumes:
- ./src:/var/www/html:delegated
networks:
- rauru_net
redis:
image: redis:alpine
container_name: rauru_redis
restart: unless-stopped
ports:
- "6379:6379"
networks:
- rauru_net
composer:
build:
context: ./dockerfiles
dockerfile: php.root.dockerfile
args:
- UID=${UID:-1000}
- GID=${GID:-1000}
container_name: rauru_composer
volumes:
- ./src:/var/www/html
depends_on:
- php
entrypoint: [ 'composer', '--ignore-platform-reqs' ]
networks:
- rauru_net
npm:
image: node:current-alpine
container_name: rauru_npm
volumes:
- ./src:/var/www/html
ports:
- "3000:3000"
- "3001:3001"
- "5173:5173"
working_dir: /var/www/html
entrypoint: [ 'npm' ]
networks:
- rauru_net
artisan:
build:
context: ./dockerfiles
dockerfile: php.root.dockerfile
args:
- UID=${UID:-1000}
- GID=${GID:-1000}
container_name: rauru_artisan
volumes:
- ./src:/var/www/html:delegated
depends_on:
- db
entrypoint: [ 'php', '/var/www/html/artisan' ]
networks:
- rauru_net
mailhog:
container_name: rauru_mailhog
image: mailhog/mailhog:latest
ports:
- "1025:1025"
- "8025:8025"
networks:
- rauru_net

@ -0,0 +1,18 @@
FROM nginx:stable-alpine
ARG UID
ARG GID
ENV UID=${UID}
ENV GID=${GID}
# MacOS staff group's gid is 20, so is the dialout group in alpine linux. We're not using it, let's just remove it.
RUN delgroup dialout
RUN addgroup -g ${GID} --system laravel
RUN adduser -G laravel --system -D -s /bin/sh -u ${UID} laravel
RUN sed -i "s/user nginx/user laravel/g" /etc/nginx/nginx.conf
ADD ./nginx/default.conf /etc/nginx/conf.d/
RUN mkdir -p /var/www/html

@ -0,0 +1,20 @@
server {
listen 80;
index index.php index.html;
server_name _;
root /var/www/html/public;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}

@ -0,0 +1,38 @@
FROM php:8-fpm-alpine
ARG UID
ARG GID
ENV UID=${UID}
ENV GID=${GID}
RUN mkdir -p /var/www/html
WORKDIR /var/www/html
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
# MacOS staff group's gid is 20, so is the dialout group in alpine linux. We're not using it, let's just remove it.
RUN delgroup dialout
RUN addgroup -g ${GID} --system laravel
RUN adduser -G laravel --system -D -s /bin/sh -u ${UID} laravel
RUN sed -i "s/user = www-data/user = laravel/g" /usr/local/etc/php-fpm.d/www.conf
RUN sed -i "s/group = www-data/group = laravel/g" /usr/local/etc/php-fpm.d/www.conf
RUN echo "php_admin_flag[log_errors] = on" >> /usr/local/etc/php-fpm.d/www.conf
RUN set -ex \
&& apk --no-cache add \
postgresql-dev
RUN docker-php-ext-install pdo pdo_mysql pdo_pgsql
RUN mkdir -p /usr/src/php/ext/redis \
&& curl -L https://github.com/phpredis/phpredis/archive/5.3.4.tar.gz | tar xvz -C /usr/src/php/ext/redis --strip 1 \
&& echo 'redis' >> /usr/src/php-available-exts \
&& docker-php-ext-install redis
USER laravel
CMD ["php-fpm", "-y", "/usr/local/etc/php-fpm.conf", "-R"]

@ -0,0 +1,26 @@
FROM php:8-fpm-alpine
RUN mkdir -p /var/www/html
WORKDIR /var/www/html
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
RUN sed -i "s/user = www-data/user = root/g" /usr/local/etc/php-fpm.d/www.conf
RUN sed -i "s/group = www-data/group = root/g" /usr/local/etc/php-fpm.d/www.conf
RUN echo "php_admin_flag[log_errors] = on" >> /usr/local/etc/php-fpm.d/www.conf
RUN set -ex \
&& apk --no-cache add \
postgresql-dev
RUN docker-php-ext-install pdo pdo_mysql pdo_pgsql
RUN mkdir -p /usr/src/php/ext/redis \
&& curl -L https://github.com/phpredis/phpredis/archive/5.3.4.tar.gz | tar xvz -C /usr/src/php/ext/redis --strip 1 \
&& echo 'redis' >> /usr/src/php-available-exts \
&& docker-php-ext-install redis
USER root
CMD ["php-fpm", "-y", "/usr/local/etc/php-fpm.conf", "-R"]
Loading…
Cancel
Save