File tree 16 files changed +217
-55
lines changed
16 files changed +217
-55
lines changed Original file line number Diff line number Diff line change 1
1
.idea
2
2
.vscode
3
- .DS_Store
3
+ .DS_Store
4
+ docker-compose.override.yml
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ phpstan.neon
20
20
.phpunit.result.cache
21
21
/tests /coverage
22
22
# ##< phpunit/phpunit ###
23
- docker-compose.override.yml
23
+
24
24
# ##> symfony/phpunit-bridge ###
25
25
.phpunit.result.cache
26
26
/phpunit.xml
Load Diff This file was deleted.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ services :
2
+ api :
3
+ environment :
4
+ # Defaults to off. See https://xdebug.org/docs/all_settings#mode for more settings
5
+ - XDEBUG_MODE=coverage
Original file line number Diff line number Diff line change
1
+ version : ' 3.5'
2
+
3
+ networks :
4
+ code_quiz :
5
+ name : code_quiz
6
+
7
+ volumes :
8
+ db-data :
9
+
10
+ services :
11
+
12
+ proxy :
13
+ build :
14
+ dockerfile : Dockerfile
15
+ context : ./proxy/
16
+ networks :
17
+ - code_quiz
18
+ ports :
19
+ - " 80:80"
20
+ restart : always
21
+ volumes :
22
+ - ./proxy/config/sites-enabled:/etc/nginx/sites-enabled
23
+ - ./proxy/config/sites-enabled:/etc/nginx/sites-available
24
+ - ./proxy/config/includes:/etc/nginx/includes
25
+ - ./proxy/config/nginx.conf:/etc/nginx.conf
26
+
27
+ website :
28
+ build :
29
+ dockerfile : Dockerfile
30
+ context : ./website/
31
+ networks :
32
+ - code_quiz
33
+
34
+ api :
35
+ build :
36
+ dockerfile : Dockerfile
37
+ context : ./api/
38
+ args :
39
+ BUILD_ENV : dev
40
+ depends_on :
41
+ - db
42
+ environment :
43
+ - XDEBUG_MODE=off
44
+ networks :
45
+ - code_quiz
46
+ volumes :
47
+ - ./api/:/var/www/html
48
+ - ./api/infra/api/xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
49
+ - ./api/infra/api/error_reporting.ini:/usr/local/etc/php/conf.d/error_reporting.ini
50
+
51
+ api-nginx :
52
+ build :
53
+ dockerfile : infra/nginx/Dockerfile
54
+ context : ./api/
55
+ args :
56
+ BUILD_ENV : dev
57
+ depends_on :
58
+ - api
59
+ networks :
60
+ - code_quiz
61
+ volumes :
62
+ - ./api/:/var/www/html
63
+
64
+ db :
65
+ image : mariadb:10.9.2
66
+ restart : always
67
+ environment :
68
+ MARIADB_ROOT_PASSWORD : test
69
+ MARIADB_DATABASE : code_quiz
70
+ networks :
71
+ - code_quiz
72
+ volumes :
73
+ - db-data:/var/lib/mysql
Original file line number Diff line number Diff line change
1
+ FROM nginx
2
+
3
+ COPY ./config/sites-enabled /etc/nginx/sites-enabled
4
+ COPY ./config/sites-enabled /etc/nginx/sites-available
5
+ COPY ./config/includes /etc/nginx/includes
6
+ COPY ./config/nginx.conf /etc/nginx/nginx.conf
Original file line number Diff line number Diff line change
1
+ proxy_set_header Host $host;
2
+ proxy_set_header X-Real-IP $remote_addr;
3
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
4
+ proxy_set_header X-Forwarded-Proto $scheme;
5
+ proxy_buffering off;
6
+ proxy_request_buffering off;
7
+ proxy_http_version 1.1;
8
+ proxy_intercept_errors on;
Original file line number Diff line number Diff line change
1
+ user nginx;
2
+ worker_processes auto;
3
+
4
+ error_log /var/log/nginx/error.log notice ;
5
+ pid /var/run/nginx.pid;
6
+
7
+
8
+ events {
9
+ worker_connections 1024 ;
10
+ }
11
+
12
+
13
+ http {
14
+ include /etc/nginx/mime.types;
15
+ default_type application/octet-stream;
16
+
17
+ log_format main '$remote_addr - $remote_user [$time_local ] "$request " '
18
+ '$status $body_bytes_sent "$http_referer " '
19
+ '"$http_user_agent " "$http_x_forwarded_for "' ;
20
+
21
+ access_log /var/log/nginx/access.log main ;
22
+
23
+ sendfile on ;
24
+ #tcp_nopush on;
25
+
26
+ keepalive_timeout 65 ;
27
+
28
+ #gzip on;
29
+
30
+ include /etc/nginx/conf.d/*.conf;
31
+ include /etc/nginx/sites-enabled/codequiz.local.conf;
32
+ include /etc/nginx/sites-enabled/api.codequiz.local.conf;
33
+ }
Original file line number Diff line number Diff line change
1
+ server {
2
+ listen 80;
3
+ server_name api.codequiz.local;
4
+
5
+ location / {
6
+ include /etc/nginx/includes/proxy.conf;
7
+ proxy_pass http://api-nginx:80;
8
+ }
9
+
10
+ access_log /var/log/nginx/api_access.log combined;
11
+ error_log /var/log/nginx/api_error.log error;
12
+ }
Original file line number Diff line number Diff line change
1
+ server {
2
+ listen 80;
3
+ server_name codequiz.local;
4
+
5
+ location / {
6
+ include /etc/nginx/includes/proxy.conf;
7
+ proxy_pass http://website:3000;
8
+ }
9
+
10
+ access_log /var/log/nginx/website.log combined;
11
+ error_log /var/log/nginx/website.log error;
12
+
13
+ }
Original file line number Diff line number Diff line change
1
+ .dockerignore
2
+ .git
3
+ .next
4
+ Dockerfile
5
+ node_modules
6
+ npm-debug.log
Original file line number Diff line number Diff line change
1
+ # Install dependencies only when needed
2
+ FROM node:16-alpine AS deps
3
+ # Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
4
+ RUN apk add --no-cache libc6-compat
5
+ WORKDIR /app
6
+
7
+ COPY package.json yarn.lock* ./
8
+ RUN yarn --frozen-lockfile
9
+
10
+
11
+ # Rebuild the source code only when needed
12
+ FROM node:16-alpine AS builder
13
+ WORKDIR /app
14
+ COPY --from=deps /app/node_modules ./node_modules
15
+ COPY . .
16
+
17
+ ENV NEXT_TELEMETRY_DISABLED 1
18
+
19
+ RUN yarn build
20
+
21
+ # If using npm comment out above and use below instead
22
+ # RUN npm run build
23
+
24
+ # Production image, copy all the files and run next
25
+ FROM node:16-alpine AS runner
26
+ WORKDIR /app
27
+
28
+ ENV NODE_ENV production
29
+ ENV NEXT_TELEMETRY_DISABLED 1
30
+
31
+ RUN addgroup --system --gid 1001 nodejs
32
+ RUN adduser --system --uid 1001 nextjs
33
+
34
+ COPY --from=builder /app/public ./public
35
+
36
+ # Automatically leverage output traces to reduce image size
37
+ # https://nextjs.org/docs/advanced-features/output-file-tracing
38
+ COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
39
+ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
40
+
41
+ USER nextjs
42
+
43
+ EXPOSE 3000
44
+
45
+ ENV PORT 3000
46
+
47
+ CMD ["node" , "server.js" ]
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " nextjs" ,
3
+ "options" : {
4
+ "allow-unauthenticated" : true ,
5
+ "memory" : " 256Mi" ,
6
+ "cpu" : " 1" ,
7
+ "port" : 3000 ,
8
+ "http2" : false
9
+ }
10
+ }
Original file line number Diff line number Diff line change 2
2
const nextConfig = {
3
3
reactStrictMode : true ,
4
4
swcMinify : true ,
5
+ output : "standalone" ,
5
6
}
6
7
7
8
module . exports = nextConfig
You can’t perform that action at this time.
0 commit comments