From c3e8226b0458b85ed056bfe1c5e83ae2f0ec5bd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Gon=C3=A7alves?= <92524572+j-pcgoncalves@users.noreply.github.com> Date: Fri, 1 Dec 2023 10:58:46 +0000 Subject: [PATCH] create dockerfile to build project image container --- .dockerignore | 5 +++++ Dockerfile | 22 ++++++++++++++++++++++ client/src/hooks/requests.js | 2 +- 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..04f1085 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +.git + +*/node_modules + +server/public \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6111457 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM node:lts-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 \ No newline at end of file diff --git a/client/src/hooks/requests.js b/client/src/hooks/requests.js index 6f03539..528fe80 100644 --- a/client/src/hooks/requests.js +++ b/client/src/hooks/requests.js @@ -1,4 +1,4 @@ -const API_URL = "http://localhost:8000/v1"; +const API_URL = "v1"; // Load planets and return as JSON async function httpGetPlanets() {