File tree Expand file tree Collapse file tree 6 files changed +87
-6
lines changed Expand file tree Collapse file tree 6 files changed +87
-6
lines changed Original file line number Diff line number Diff line change 77 - master
88
99env :
10+ QUESTIONS_IMAGE_NAME : peerprep-questions-service
1011 FRONTEND_IMAGE_NAME : peerprep-frontend
1112 NGINX_IMAGE_NAME : peerprep-nginx
1213
1314jobs :
15+ build-questions-image :
16+ runs-on : ubuntu-latest
17+ permissions :
18+ contents : read
19+ packages : write
20+ steps :
21+ - name : Check out Source
22+ uses : actions/checkout@v2
23+ - name : Log in to the Container Registry
24+ uses : docker/login-action@v1
25+ with :
26+ registry : ghcr.io
27+ username : peerprep
28+ password : ${{ secrets.GITHUB_TOKEN }}
29+ - name : Build and Push Docker Image
30+ uses : docker/build-push-action@v2
31+ with :
32+ context : .
33+ file : deployment/Dockerfile-questions
34+ push : true
35+ tags : ghcr.io/peerprep/${{ env.QUESTIONS_IMAGE_NAME }}:latest
36+
1437 build-frontend-image :
1538 runs-on : ubuntu-latest
1639 permissions :
Original file line number Diff line number Diff line change 1+ # To build a Docker image from this file, run from the root directory:
2+ # docker build -f deployment/Dockerfile-questions -t peerprep-questions-service .
3+
4+ # Intermediate image for building the Next app
5+ FROM node:18.17.1
6+
7+ # Environment variables
8+ ENV APP_ROOT /questions
9+
10+ # Copy source code into container
11+ RUN mkdir --parents $APP_ROOT
12+ WORKDIR $APP_ROOT
13+ COPY questions .
14+
15+ # Install dependencies
16+ RUN yarn install --frozen-lockfile
17+
18+ # Build app
19+ RUN yarn build
20+
21+ # Expose port
22+ EXPOSE 4000
23+
24+ # Final image for running the Express app
25+ CMD ["yarn", "start"]
Original file line number Diff line number Diff line change 11version : " 3.8"
22
33services :
4+ mongo :
5+ container_name : peerprep-mongo
6+ image : mongo
7+ restart : always
8+ volumes :
9+ - ./mongodb-data:/data/db
10+ logging :
11+ driver : journald
12+ networks :
13+ - peerprep-network
14+ expose :
15+ - " 27017"
16+
17+ questions :
18+ image : ghcr.io/peerprep/peerprep-questions:latest
19+ container_name : peerprep-questions
20+ restart : always
21+ depends_on :
22+ - mongo
23+ networks :
24+ - peerprep-network
25+ logging :
26+ driver : journald
27+ expose :
28+ - " 4000"
29+ environment :
30+ MONGODB_URL : " mongodb://peerprep-mongo:27017/questions"
31+
432 frontend :
533 image : ghcr.io/peerprep/peerprep-frontend:latest
634 container_name : peerprep-frontend
735 restart : always
36+ depends_on :
37+ - questions
838 networks :
939 - peerprep-network
1040 logging :
Original file line number Diff line number Diff line change 44 "description" : " " ,
55 "main" : " index.js" ,
66 "scripts" : {
7- "dev" : " nodemon"
7+ "dev" : " nodemon" ,
8+ "build" : " tsc" ,
9+ "start" : " node build/index.js"
810 },
911 "author" : " " ,
1012 "license" : " ISC" ,
Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ import http from "http";
66import mongoose from "mongoose" ;
77import router from "./router" ;
88
9- const MONGO_URL = "mongodb://localhost:27017/questions" ;
9+ const MONGO_URL =
10+ process . env . MONGODB_URL || "mongodb://localhost:27017/questions" ;
1011
1112mongoose . Promise = Promise ;
1213mongoose . connect ( MONGO_URL ) ;
@@ -24,8 +25,8 @@ app.use(bodyParser.json());
2425
2526const server = http . createServer ( app ) ;
2627
27- server . listen ( 3000 , ( ) => {
28- console . log ( "Server is listening on port 3000 " ) ;
28+ server . listen ( 4000 , ( ) => {
29+ console . log ( "Server is listening on port 4000 " ) ;
2930} ) ;
3031
3132app . use ( "/" , router ( ) ) ;
Original file line number Diff line number Diff line change 11{
22 "compilerOptions" : {
33 "module" : " NodeNext" ,
4- "moduleResolution" : " node " ,
4+ "moduleResolution" : " NodeNext " ,
55 "baseUrl" : " src" ,
6- "outDir" : " dist " ,
6+ "outDir" : " build " ,
77 "sourceMap" : true ,
88 "noImplicitAny" : true
99 },
You can’t perform that action at this time.
0 commit comments