diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..04f10855 --- /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 00000000..fab32c89 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +FROM node:lts-alpine + +WORKDIR /app + +# Copy and install dependencies for the client +COPY client/package*.json ./client/ +RUN npm install --prefix client --omit=dev + +# Copy and install dependencies for the server +COPY server/package*.json ./server/ +RUN npm install --prefix server --omit=dev + +# Copy the rest of the client files and build the client +COPY client/ ./client/ +RUN npm run build --prefix client + +# Copy the server files after the client is built +COPY server/ ./server/ + +# Ensure the server/public directory exists +RUN mkdir -p ./server/public + +# Move the built client files to the server's public directory +RUN cp -R ./client/build/* ./server/public/ + +USER node + +# Start the server +CMD ["npm", "start", "--prefix", "server"] + +# Expose the port +EXPOSE 5000 + diff --git a/client/src/hooks/requests.js b/client/src/hooks/requests.js index d9d339e6..ff447973 100644 --- a/client/src/hooks/requests.js +++ b/client/src/hooks/requests.js @@ -1,4 +1,4 @@ -const API_URL = 'http://localhost:5000/v1'; +const API_URL = 'v1'; async function httpGetPlanets() { const response = await fetch(`${API_URL}/planets`); diff --git a/server/src/models/launches.model.js b/server/src/models/launches.model.js index 1034a213..71917cef 100644 --- a/server/src/models/launches.model.js +++ b/server/src/models/launches.model.js @@ -98,7 +98,7 @@ async function addNewLaunch(launch) { ...launch, success: true, upcoming: true, - customers: ['Zero to Mastery', 'NASA'], + customers: ['ORS', 'NASA'], flightNumber: await getLatestFlightNumber() + 1, };