From cdad56bb32d82dfa412bed1990bb782d05e7d384 Mon Sep 17 00:00:00 2001 From: ooodogodogodogo Date: Tue, 1 Nov 2022 01:00:22 +0300 Subject: [PATCH] Last changes for deployment. --- App/backend/backend/settings/production.py | 2 +- App/frontend/Dockerfile.production | 27 ++++++++-------------- App/frontend/src/components/LoginModal.js | 2 +- App/frontend/src/components/SignupModal.js | 2 +- App/frontend/src/layout/Sidebar.js | 2 +- 5 files changed, 13 insertions(+), 22 deletions(-) diff --git a/App/backend/backend/settings/production.py b/App/backend/backend/settings/production.py index e0cf2717..a68f3921 100644 --- a/App/backend/backend/settings/production.py +++ b/App/backend/backend/settings/production.py @@ -1,7 +1,7 @@ from .base import * DEBUG = True # Set this to False in the future and fill in the allowed_hosts section. -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ['34.125.134.88'] DATABASES = { 'default': { diff --git a/App/frontend/Dockerfile.production b/App/frontend/Dockerfile.production index dc35644f..533130ae 100644 --- a/App/frontend/Dockerfile.production +++ b/App/frontend/Dockerfile.production @@ -1,22 +1,13 @@ -FROM node:16-alpine AS builder - -ENV NODE_ENV production - +# build step +FROM node:16.13.2-alpine as build WORKDIR /app - -COPY ./package.json ./ - +COPY package.json ./ RUN npm install - -COPY . . - +COPY . ./ RUN npm run build -# Fetching the latest nginx image -FROM nginx - -# Copying built assets from builder -COPY --from=builder /app/build /usr/share/nginx/html - -# Copying our nginx.conf -COPY nginx.conf /etc/nginx/conf.d/default.conf \ No newline at end of file +# release step +FROM nginx:1.21.5-alpine as release +COPY --from=build /app/build /usr/share/nginx/html/ +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/App/frontend/src/components/LoginModal.js b/App/frontend/src/components/LoginModal.js index 5e0f18ba..105af6a1 100644 --- a/App/frontend/src/components/LoginModal.js +++ b/App/frontend/src/components/LoginModal.js @@ -20,7 +20,7 @@ function Login(props) { function handleSubmit(event) { event.preventDefault(); - fetch("http://44.211.68.74:8000/api/v1/auth/login/", { + fetch("http://34.125.134.88:8000/api/v1/auth/login/", { method: "POST", body: JSON.stringify(loginInput), headers: { diff --git a/App/frontend/src/components/SignupModal.js b/App/frontend/src/components/SignupModal.js index cc960b06..fed6c723 100644 --- a/App/frontend/src/components/SignupModal.js +++ b/App/frontend/src/components/SignupModal.js @@ -22,7 +22,7 @@ function Signup(props) { function handleSubmit(event) { event.preventDefault(); - fetch("http://44.211.68.74:8000/api/v1/auth/register/", { + fetch("http://34.125.134.88:8000/api/v1/auth/register/", { method: "POST", body: JSON.stringify(signupInput), headers: { diff --git a/App/frontend/src/layout/Sidebar.js b/App/frontend/src/layout/Sidebar.js index 31655ed6..69ada282 100644 --- a/App/frontend/src/layout/Sidebar.js +++ b/App/frontend/src/layout/Sidebar.js @@ -12,7 +12,7 @@ function Sidebar(props) { function handleLogOut() { - fetch("http://44.211.68.74:8000/api/v1/auth/logout/", { + fetch("http://34.125.134.88:8000/api/v1/auth/logout/", { method: "POST", body: "", headers: {