updates distributed service
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# Dockerfile for CSE folders
|
||||
# Dockerfile for Math folders
|
||||
|
||||
# Source: https://github.com/vercel/next.js/blob/canary/examples/with-docker-multi-env/docker/production/Dockerfile
|
||||
# syntax=docker.io/docker/dockerfile:1
|
||||
@@ -28,10 +28,21 @@ FROM base AS builder
|
||||
WORKDIR /app
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
RUN ls -la
|
||||
|
||||
# 2.1 Remove unnecessary files for build with title not starting with CSE
|
||||
RUN find ./content -type d -not -name "CSE*" -exec rm -rf {} +
|
||||
RUN find ./public -type f -not -name "*.md" -exec rm -rf {} +
|
||||
# 2.1 Remove unnecessary files for build with title starting with CSE
|
||||
RUN cd ./content && find . -maxdepth 1 -type d -name "Math*" -exec rm -rf {} +
|
||||
RUN cd ./public && find . -maxdepth 1 -type d -name "Math*" -exec rm -rf {} +
|
||||
|
||||
# 2.1.1 Check the updated folders
|
||||
RUN cd ./content && ls -la
|
||||
RUN cd ./public && ls -la
|
||||
|
||||
# 2.2 Update the _meta.js files in the content folder
|
||||
RUN sed -i '/\/\* Math Courses Start \*\//,/\/\* Math Courses End \*\//d' ./content/_meta.js
|
||||
|
||||
# 2.2.1 Check the updated _meta.js file
|
||||
RUN cat ./content/_meta.js
|
||||
|
||||
# This will do the trick, use the corresponding env file for each environment.
|
||||
# COPY .env.production.sample .env.production
|
||||
@@ -55,8 +66,8 @@ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||
|
||||
USER nextjs
|
||||
|
||||
EXPOSE 3000
|
||||
EXPOSE 4201
|
||||
|
||||
ENV PORT=3000
|
||||
ENV PORT=4201
|
||||
|
||||
CMD HOSTNAME="0.0.0.0" node server.js
|
||||
1
docker/cse/test-build.sh
Normal file
1
docker/cse/test-build.sh
Normal file
@@ -0,0 +1 @@
|
||||
sudo docker build -t trance-0/notenextra-cse:v1.2.0 -f ./docker/cse/Dockerfile --no-cache --progress=plain .
|
||||
30
docker/docker-compose.yaml
Normal file
30
docker/docker-compose.yaml
Normal file
@@ -0,0 +1,30 @@
|
||||
services:
|
||||
# you may need to update relative directories if you move this file
|
||||
# default created directories is /docker/docker-compose.yaml
|
||||
notenextra-math:
|
||||
build:
|
||||
context: ../
|
||||
dockerfile: ./docker/math/Dockerfile
|
||||
tags:
|
||||
- trance0/notenextra-math:latest
|
||||
restart: on-failure:5
|
||||
ports:
|
||||
- 13001:4201
|
||||
notenextra-cse:
|
||||
build:
|
||||
context: ../
|
||||
dockerfile: ./docker/cse/Dockerfile
|
||||
tags:
|
||||
- trance0/notenextra-cse:latest
|
||||
restart: on-failure:5
|
||||
ports:
|
||||
- 13002:4202
|
||||
nginx:
|
||||
image: nginx:latest
|
||||
ports:
|
||||
- 13000:80
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/nginx.conf
|
||||
depends_on:
|
||||
- notenextra-math
|
||||
- notenextra-cse
|
||||
@@ -28,12 +28,21 @@ FROM base AS builder
|
||||
WORKDIR /app
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
RUN ls -la
|
||||
|
||||
# 2.1 Remove unnecessary files for build with title starting with CSE
|
||||
RUN cd /app/content
|
||||
RUN find . -maxdepth 1 -type d -name "CSE*" -delete
|
||||
RUN cd /app/public
|
||||
RUN find . -maxdepth 1 -type d -name "CSE*" -delete
|
||||
RUN cd ./content && find . -maxdepth 1 -type d -name "CSE*" -exec rm -rf {} +
|
||||
RUN cd ./public && find . -maxdepth 1 -type d -name "CSE*" -exec rm -rf {} +
|
||||
|
||||
# 2.1.1 Check the updated folders
|
||||
RUN cd ./content && ls -la
|
||||
RUN cd ./public && ls -la
|
||||
|
||||
# 2.2 Update the _meta.js files in the content folder
|
||||
RUN sed -i '/\/\* CSE Courses Start \*\//,/\/\* CSE Courses End \*\//d' ./content/_meta.js
|
||||
|
||||
# 2.2.1 Check the updated _meta.js file
|
||||
RUN cat ./content/_meta.js
|
||||
|
||||
# This will do the trick, use the corresponding env file for each environment.
|
||||
# COPY .env.production.sample .env.production
|
||||
|
||||
1
docker/math/test-build.sh
Normal file
1
docker/math/test-build.sh
Normal file
@@ -0,0 +1 @@
|
||||
sudo docker build -t trance-0/notenextra-math:v1.2.0 -f ./docker/math/Dockerfile --no-cache --progress=plain .
|
||||
23
docker/nginx.conf
Normal file
23
docker/nginx.conf
Normal file
@@ -0,0 +1,23 @@
|
||||
# Example for conf.d/default.conf
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
location /Math* {
|
||||
proxy_pass http://notenextra-math:4201;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location /CSE* {
|
||||
proxy_pass http://notenextra-cse:4202;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user