Skip to content

Commit cdb7cec

Browse files
committed
app-dockerization
1 parent f5d92e1 commit cdb7cec

3 files changed

Lines changed: 38 additions & 0 deletions

File tree

Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM node:alpine
2+
3+
LABEL version="1.0"
4+
LABEL description="Code Editor."
5+
LABEL maintainer=["mohitur669@gmail.com"]
6+
7+
WORKDIR /app
8+
9+
COPY ["package.json", "package-lock.json", "./"]
10+
11+
RUN npm install --production
12+
13+
COPY . .
14+
15+
# Set environment variables
16+
ENV REACT_APP_BACKEND_URL=<your_backend_url>
17+
ENV SERVER_PORT=<your_server_port>
18+
19+
# Expose the necessary ports
20+
EXPOSE 5000
21+
EXPOSE 8000
22+
EXPOSE 3000
23+
24+
# Run the application
25+
CMD ["npm", "run", "start:docker"]

docker-compose.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: "3"
2+
3+
services:
4+
code-editor:
5+
build:
6+
context: .
7+
dockerfile: ./Dockerfile
8+
image: "<your_docker_username>/code-editor"
9+
ports:
10+
- "5000:5000"
11+
- "3000:3000"
12+
- "8000:8000"

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"web-vitals": "^2.1.4"
2323
},
2424
"scripts": {
25+
"start:docker": "pm2 start server.js && npm start",
2526
"start": "react-scripts start",
2627
"build": "react-scripts build",
2728
"build:digitalocean": "npm install --force && react-scripts build",

0 commit comments

Comments
 (0)