Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit30ae531

Browse files
committed
Adds another full set of root-user dockerfiles
Also adds matching root-user docker-compose.yml file
1 parent9d56cdd commit30ae531

8 files changed

+176
-4
lines changed

‎docker-compose.root.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
version:'3'
2+
3+
networks:
4+
laravel:
5+
6+
services:
7+
site:
8+
build:
9+
context:./dockerfiles
10+
dockerfile:nginx.root.dockerfile
11+
container_name:nginx
12+
ports:
13+
-80:80
14+
volumes:
15+
-./src:/var/www/html:delegated
16+
depends_on:
17+
-php
18+
-redis
19+
-mysql
20+
-mailhog
21+
networks:
22+
-laravel
23+
24+
mysql:
25+
image:mariadb:10.6
26+
container_name:mysql
27+
restart:unless-stopped
28+
tty:true
29+
ports:
30+
-3306:3306
31+
environment:
32+
MYSQL_DATABASE:homestead
33+
MYSQL_USER:homestead
34+
MYSQL_PASSWORD:secret
35+
MYSQL_ROOT_PASSWORD:secret
36+
SERVICE_TAGS:dev
37+
SERVICE_NAME:mysql
38+
networks:
39+
-laravel
40+
41+
php:
42+
build:
43+
context:./dockerfiles
44+
dockerfile:php.root.dockerfile
45+
container_name:php
46+
volumes:
47+
-./src:/var/www/html:delegated
48+
networks:
49+
-laravel
50+
51+
redis:
52+
image:redis:alpine
53+
container_name:redis
54+
restart:unless-stopped
55+
ports:
56+
-6379:6379
57+
networks:
58+
-laravel
59+
60+
composer:
61+
build:
62+
context:./dockerfiles
63+
dockerfile:composer.root.dockerfile
64+
container_name:composer
65+
volumes:
66+
-./src:/var/www/html
67+
working_dir:/var/www/html
68+
depends_on:
69+
-php
70+
user:root
71+
entrypoint:['composer', '--ignore-platform-reqs']
72+
networks:
73+
-laravel
74+
75+
npm:
76+
image:node:13.7
77+
container_name:npm
78+
volumes:
79+
-./src:/var/www/html
80+
ports:
81+
-3000:3000
82+
-3001:3001
83+
working_dir:/var/www/html
84+
entrypoint:['npm']
85+
networks:
86+
-laravel
87+
88+
artisan:
89+
build:
90+
context:./dockerfiles
91+
dockerfile:php.root.dockerfile
92+
container_name:artisan
93+
volumes:
94+
-./src:/var/www/html:delegated
95+
depends_on:
96+
-mysql
97+
working_dir:/var/www/html
98+
entrypoint:['php', '/var/www/html/artisan']
99+
networks:
100+
-laravel
101+
102+
mailhog:
103+
image:mailhog/mailhog:latest
104+
container_name:mailhog
105+
ports:
106+
-1025:1025
107+
-8025:8025
108+
networks:
109+
-laravel

‎docker-compose.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ networks:
66
services:
77
site:
88
build:
9-
context:.
9+
context:./dockerfiles
1010
dockerfile:nginx.dockerfile
1111
args:
1212
-UID=${UID:-1000}
@@ -43,7 +43,7 @@ services:
4343

4444
php:
4545
build:
46-
context:.
46+
context:./dockerfiles
4747
dockerfile:php.dockerfile
4848
args:
4949
-UID=${UID:-1000}
@@ -65,7 +65,7 @@ services:
6565

6666
composer:
6767
build:
68-
context:.
68+
context:./dockerfiles
6969
dockerfile:composer.dockerfile
7070
args:
7171
-UID=${UID:-1000}
@@ -96,7 +96,7 @@ services:
9696

9797
artisan:
9898
build:
99-
context:.
99+
context:./dockerfiles
100100
dockerfile:php.dockerfile
101101
args:
102102
-UID=${UID:-1000}
File renamed without changes.

‎dockerfiles/composer.root.dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM composer:2
2+
3+
ARG UID
4+
ARG GID
5+
6+
ENV UID=${UID}
7+
ENV GID=${GID}
8+
9+
# 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.
10+
RUN delgroup dialout
11+
12+
RUN addgroup -g ${GID} --system laravel
13+
RUN adduser -G laravel --system -D -s /bin/sh -u ${UID} laravel
14+
15+
WORKDIR /var/www/html
File renamed without changes.

‎dockerfiles/nginx.root.dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM nginx:stable-alpine
2+
3+
ARG UID
4+
ARG GID
5+
6+
ENV UID=${UID}
7+
ENV GID=${GID}
8+
9+
# 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.
10+
RUN delgroup dialout
11+
12+
RUN addgroup -g ${GID} --system laravel
13+
RUN adduser -G laravel --system -D -s /bin/sh -u ${UID} laravel
14+
RUN sed -i"s/user nginx/user laravel/g" /etc/nginx/nginx.conf
15+
16+
ADD ./nginx/default.conf /etc/nginx/conf.d/
17+
18+
RUN mkdir -p /var/www/html
File renamed without changes.

‎dockerfiles/php.root.dockerfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
FROM php:8-fpm-alpine
2+
3+
ARG UID
4+
ARG GID
5+
6+
ENV UID=${UID}
7+
ENV GID=${GID}
8+
9+
RUN mkdir -p /var/www/html
10+
11+
WORKDIR /var/www/html
12+
13+
# 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.
14+
RUN delgroup dialout
15+
16+
RUN addgroup -g ${GID} --system laravel
17+
RUN adduser -G laravel --system -D -s /bin/sh -u ${UID} laravel
18+
19+
RUN sed -i"s/user = www-data/user = laravel/g" /usr/local/etc/php-fpm.d/www.conf
20+
RUN sed -i"s/group = www-data/group = laravel/g" /usr/local/etc/php-fpm.d/www.conf
21+
RUN echo"php_admin_flag[log_errors] = on" >> /usr/local/etc/php-fpm.d/www.conf
22+
23+
RUN docker-php-ext-install pdo pdo_mysql
24+
25+
RUN mkdir -p /usr/src/php/ext/redis \
26+
&& curl -L https://github.com/phpredis/phpredis/archive/5.3.4.tar.gz | tar xvz -C /usr/src/php/ext/redis --strip 1 \
27+
&& echo'redis' >> /usr/src/php-available-exts \
28+
&& docker-php-ext-install redis
29+
30+
CMD ["php-fpm","-y","/usr/local/etc/php-fpm.conf","-R"]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp