Skip to content

Commit

Permalink
Merge pull request #11 from luiscarlos-ja:adding-docker
Browse files Browse the repository at this point in the history
Add Dockerfile and .dockerignore files
  • Loading branch information
luiscarlos-ja committed Mar 31, 2024
2 parents cd9ed9e + c59cde5 commit b16ff34
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.git

*/node_modules

server/public
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM node:20.12.0-alpine

WORKDIR /app

COPY package*.json ./

COPY client/package*.json client/
RUN npm run install-client --omit=dev

COPY server/package*.json server/
RUN npm run install-server --omit=dev

COPY client/ client/
RUN npm run build --prefix client

COPY server/ server/

USER node

CMD ["npm", "start", "--prefix", "server"]

EXPOSE 8000
3 changes: 2 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
},
"scripts": {
"start": "react-scripts start",
"build": "set BUILD_PATH=../server/public&& react-scripts build",
"build": "BUILD_PATH=../server/public react-scripts build",
"build-windows": "set BUILD_PATH=../server/public&& react-scripts build",
"test": "react-scripts test --passWithNoTests",
"eject": "react-scripts eject"
},
Expand Down
2 changes: 1 addition & 1 deletion client/src/hooks/requests.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const API_URL = "http://localhost:8000/v1";
const API_URL = "v1";
// Load planets and return as JSON.
async function httpGetPlanets() {
try {
Expand Down
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"test": "jest --detectOpenHandles --coverage --verbose",
"test-watch": "jest --detectOpenHandles --watchAll --coverage --verbose",
"start": "set PORT=5000&& node src/server.js",
"start": "node src/server.js",
"watch": "nodemon src/server.js",
"cluster": "pm2 start src/server.js -i max"
},
Expand Down

0 comments on commit b16ff34

Please sign in to comment.