diff --git a/backend/Dockerfile b/backend/Dockerfile index 1e80c45..3c04ce5 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,16 +1,22 @@ # # Build stage # -FROM maven:3.6.0-jdk-11-slim AS build -COPY src /home/app/src -COPY pom.xml /home/app -RUN mvn -f /home/app/pom.xml clean package +FROM maven:3.8.4-openjdk-11 AS build +WORKDIR /app -# -# Package stage -# -FROM openjdk:11-jre-slim -COPY --from=build /home/app/target/spring-boot-ecommerce-0.0.1-SNAPSHOT.jar /usr/local/lib/spring-boot-ecommerce.jar -EXPOSE 8443 -ENTRYPOINT ["java","-jar","/usr/local/lib/spring-boot-ecommerce.jar"] +COPY pom.xml ./ + + + +COPY src ./src + + + + + +COPY target/*.jar app.jar + +EXPOSE 8080 + +ENTRYPOINT ["java","-jar","app.jar"] diff --git a/backend/pom.xml b/backend/pom.xml index 34593e5..abf0fbe 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -43,7 +43,7 @@ mysql mysql-connector-java - runtime + 8.0.29 org.projectlombok diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index 1673d2f..7341652 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -6,24 +6,22 @@ # ##### spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver -spring.datasource.url=jdbc:mysql://roundhouse.proxy.rlwy.net:58778/railway +spring.datasource.url=jdbc:mysql://mysqlservice:3306/mysql?allowPublicKeyRetrieval=true&useSSL=false spring.datasource.username=root -spring.datasource.password=-HbF5dh1Ag6HFHFHd5hE226dHHAc1E-e +spring.datasource.password=root -spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect spring.data.rest.base-path=/api -#allowed.origins=https://localhost:4200 +allowed.origins=http://localhost:4200 -allowed.origins=https://luv2shop-ecommerce.netlify.app +#allowed.origins=https://luv2shop-ecommerce.netlify.app spring.data.rest.detection-strategy=ANNOTATED okta.oauth2.client-id=0oac1xv78jEJHLiLn5d7 okta.oauth2.issuer=https://dev-68343085.okta.com/oauth2/default - -##### + qwed # # HTTPS configuration # @@ -69,5 +67,7 @@ spring.security.ignored=/** # Configure the path matching strategy for Spring MVC spring.mvc.pathmatch.matching-strategy=ANT_PATH_MATCHER +spring.jpa.hibernate.ddl-auto=update +spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect diff --git a/frontend/Dockerfile.dockerfile b/frontend/Dockerfile.dockerfile new file mode 100644 index 0000000..3ace796 --- /dev/null +++ b/frontend/Dockerfile.dockerfile @@ -0,0 +1,30 @@ +FROM node:14.20.0-alpine as build + +WORKDIR /app + + + + +COPY package*.json ./ + + +# Install Angular CLI +RUN npm install -g @angular/cli@16.2.6 + +RUN npm install + +COPY . . + +RUN npm run build + +### STAGE 2: Run ### +FROM nginx:alpine + + + +#### copy artifact build from the 'build environment' +COPY --from=build /app/dist/angular-ecommerce /usr/share/nginx/html + +EXPOSE 80 + +CMD["nginx", "-g","daemon off;"]] diff --git a/frontend/nginx.conf b/frontend/nginx.conf new file mode 100644 index 0000000..2b7a475 --- /dev/null +++ b/frontend/nginx.conf @@ -0,0 +1,21 @@ +server { + listen 0.0.0.0:8080; + listen [::]:8080; + default_type application/octet-stream; + + gzip on; + gzip_comp_level 6; + gzip_vary on; + gzip_min_length 1000; + gzip_proxied any; + gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; + gzip_buffers 16 8k; + gunzip on; + client_max_body_size 256M; + + root /usr/share/nginx/html; + + location / { + try_files $uri $uri/ /index.html =404; + } +} diff --git a/frontend/package.json b/frontend/package.json index 7ccd2eb..758bb52 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "scripts": { "ng": "ng", - "start": "ng serve --o --ssl=true --ssl-key=./ssl-localhost/localhost.key --ssl-cert=./ssl-localhost/localhost.crt", + "start": "ng serve", "build": "ng build", "watch": "ng build --watch --configuration development", "test": "ng test" @@ -43,4 +43,4 @@ "karma-jasmine-html-reporter": "~2.0.0", "typescript": "~4.7.2" } -} +} \ No newline at end of file diff --git a/frontend/src/environments/environment.prod.ts b/frontend/src/environments/environment.prod.ts index 21d943a..f4219bb 100644 --- a/frontend/src/environments/environment.prod.ts +++ b/frontend/src/environments/environment.prod.ts @@ -1,6 +1,6 @@ export const environment = { production: true, - apiUrl: 'https://luv2shop-backend.onrender.com/api', + apiUrl: 'https://backend-k-a-nagaraju1-dev.apps.rm1.0a51.p1.openshiftapps.com/api', stripePublishableKey: 'pk_test_51NaiSfJ7CqAb5XkluTiXqbDsuJ6IMsWiZgTPCmmKaouA5D3UJGXpXZcFNFM1os4yTZonDreg6w9EUMkk2eagZAE600dy8Thabh', }; diff --git a/frontend/src/environments/environment.ts b/frontend/src/environments/environment.ts index 24fbb66..030f402 100644 --- a/frontend/src/environments/environment.ts +++ b/frontend/src/environments/environment.ts @@ -4,7 +4,7 @@ export const environment = { production: false, - apiUrl: 'https://localhost:8443/api', + apiUrl: 'https://backend-k-a-nagaraju1-dev.apps.rm1.0a51.p1.openshiftapps.com/api', stripePublishableKey: 'pk_test_51NaiSfJ7CqAb5XkluTiXqbDsuJ6IMsWiZgTPCmmKaouA5D3UJGXpXZcFNFM1os4yTZonDreg6w9EUMkk2eagZAE600dy8Thabh', }; diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index 2f915b2..3519899 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -27,5 +27,6 @@ "strictInjectionParameters": true, "strictInputAccessModifiers": true, "strictTemplates": true + } }