Skip to content

Commit 58ea956

Browse files
deployed to azure
1 parent 6d67c17 commit 58ea956

File tree

3 files changed

+34
-11
lines changed

3 files changed

+34
-11
lines changed

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Build a JAR File
2+
FROM maven:3.8.2-jdk-8-slim AS stage1
3+
WORKDIR /home/app
4+
COPY . /home/app/
5+
RUN mvn -f /home/app/pom.xml clean package
6+
7+
# Create an Image
8+
FROM openjdk:8-jdk-alpine
9+
EXPOSE 8080
10+
COPY --from=stage1 /home/app/target/courseapi-backend-0.0.1-SNAPSHOT.jar courseapi-backend.jar
11+
ENTRYPOINT ["sh", "-c", "java -jar /courseapi-backend.jar"]

README.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22

33
Here I have created a production grade CourseAPI complete CRUD backend using Spring Boot, JPA, my own PostgreSQL Database instance and hosted it on Heroku.
44

5-
#### Live Link - [Hosted on Heroku](https://courseapi-spring-boot.herokuapp.com)
5+
#### Live Link - [Hosted on Azure](https://courseapi-backend.azurewebsites.net)
66

77

88

99
### Sample APIs to check the functionalities
1010

11-
- GetAllTopics - https://courseapi-spring-boot.herokuapp.com/topics
12-
- GetAllCourses for Topic Id "java" - https://courseapi-spring-boot.herokuapp.com/topics/java/courses
11+
- GetAllTopics - https://courseapi-backend.azurewebsites.net/api/topics
12+
- GetAllCourses for Topic Id "java" - https://courseapi-backend.azurewebsites.net/api/topics/java/courses
1313

14-
- GetAllLessons for Course Id "java-8"- https://courseapi-spring-boot.herokuapp.com/topics/java/courses/java-8/lessons
14+
- GetAllLessons for Course Id "java-8"- https://courseapi-backend.azurewebsites.net/api/topics/java/courses/java-8/lessons
1515

16-
- Get API health - https://courseapi-spring-boot.herokuapp.com/actuator/health
16+
- Get API health - https://courseapi-backend.azurewebsites.net/api/actuator/health
1717

18-
- **Swagger UI to Test all APIs** - https://courseapi-spring-boot.herokuapp.com/swagger-ui.html
18+
- **Swagger UI to Test all APIs** - https://courseapi-backend.azurewebsites.net/api/swagger-ui.html
1919

2020

2121

@@ -76,7 +76,7 @@ Here we have 3 Controllers
7676

7777
### Demo
7878

79-
Fetching all Topics : https://courseapi-spring-boot.herokuapp.com/topics
79+
Fetching all Topics : https://courseapi-backend.azurewebsites.net/api/topics
8080

8181
```json
8282
[
@@ -95,7 +95,7 @@ Fetching all Topics : https://courseapi-spring-boot.herokuapp.com/topics
9595

9696

9797

98-
Fetching All courses under Topic Id "java" : https://courseapi-spring-boot.herokuapp.com/topics/java/courses
98+
Fetching All courses under Topic Id "java" : https://courseapi-backend.azurewebsites.net/api/topics/java/courses
9999

100100
```json
101101
[
@@ -114,7 +114,7 @@ Fetching All courses under Topic Id "java" : https://courseapi-spring-boot.herok
114114

115115

116116

117-
Fetching All lessons under Course Id "java-8" : https://courseapi-spring-boot.herokuapp.com/topics/java/courses/java-8/lessons
117+
Fetching All lessons under Course Id "java-8" : https://courseapi-backend.azurewebsites.net/api/topics/java/courses/java-8/lessons
118118

119119
```json
120120
[
@@ -136,6 +136,18 @@ Fetching All lessons under Course Id "java-8" : https://courseapi-spring-boot.he
136136
]
137137
```
138138

139+
### Docker commands
140+
```sh
141+
# Build
142+
docker build -t swarnadeepghosh/courseapi-backend:0.0.1-RELEASE .
143+
144+
# Run in local
145+
docker run -d -p 8080:8080 --name=courseapi-backend swarnadeepghosh/courseapi-backend:0.0.1-RELEASE
146+
147+
# push to dockerhub
148+
docker push swarnadeepghosh/courseapi-backend:0.0.1-RELEASE
149+
```
150+
139151

140152

141153
### Credits

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>com.swarna.springboot</groupId>
6-
<artifactId>CourseAPI-Spring-Starter</artifactId>
6+
<artifactId>courseapi-backend</artifactId>
77
<version>0.0.1-SNAPSHOT</version>
88
<packaging>jar</packaging>
9-
<name>CourseAPI-Spring-Starter</name>
9+
<name>courseapi-backend</name>
1010
<description>CourseAPI-Spring Boot Starter project created took help from Java Brains</description>
1111

1212
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-parent -->

0 commit comments

Comments
 (0)