Skip to content

Commit f3d06f3

Browse files
committed
Migrates nginx build to Dockerfile, adds 1000 user to php/nginx services
1 parent 8e32357 commit f3d06f3

File tree

4 files changed

+477
-2
lines changed

4 files changed

+477
-2
lines changed

docker-compose.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ networks:
55

66
services:
77
site:
8-
image: nginx:stable-alpine
8+
build:
9+
context: .
10+
dockerfile: nginx.dockerfile
911
container_name: nginx
1012
ports:
1113
- "8080:80"
1214
volumes:
1315
- ./src:/var/www/html:delegated
14-
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
1516
depends_on:
1617
- php
1718
- mysql

nginx.dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM nginx:stable-alpine
2+
3+
RUN addgroup -S 1000 && adduser -S 1000 -G 1000
4+
5+
ADD ./nginx/nginx.conf /etc/nginx/nginx.conf
6+
ADD ./nginx/default.conf /etc/nginx/conf.d/default.conf

nginx/nginx.conf

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
user 1000;
2+
worker_processes auto;
3+
4+
error_log /var/log/nginx/error.log warn;
5+
pid /var/run/nginx.pid;
6+
7+
events {
8+
worker_connections 1024;
9+
}
10+
11+
http {
12+
include /etc/nginx/mime.types;
13+
default_type application/octet-stream;
14+
15+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
16+
'$status $body_bytes_sent "$http_referer" '
17+
'"$http_user_agent" "$http_x_forwarded_for"';
18+
19+
access_log /var/log/nginx/access.log main;
20+
21+
sendfile on;
22+
#tcp_nopush on;
23+
24+
keepalive_timeout 65;
25+
26+
#gzip on;
27+
28+
include /etc/nginx/conf.d/*.conf;
29+
}

0 commit comments

Comments
 (0)