generated from moevm/nsql-clean-tempate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add docker and demo_request.sh
- Loading branch information
Showing
3 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM maven:3.8.4-openjdk-17 AS build | ||
WORKDIR /app | ||
COPY . . | ||
RUN mvn clean package -DskipTests | ||
|
||
FROM openjdk:17-jdk-slim | ||
WORKDIR /app | ||
COPY --from=build /app/target/MongoExample-1.0.jar /app/app.jar | ||
ENTRYPOINT ["java", "-jar", "/app/app.jar"] | ||
EXPOSE 8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
echo "GET request to /messages" | ||
curl http://localhost:8080/messages | ||
|
||
echo -e "\nPOST request to /messages" | ||
curl -X POST http://localhost:8080/messages -H "Content-Type: application/json" -d '{"content": "Hello, World!"}' | ||
|
||
echo -e "GET request to /messages after POST request" | ||
curl http://localhost:8080/messages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
version: '3.8' | ||
|
||
services: | ||
app: | ||
build: . | ||
ports: | ||
- "8080:8080" | ||
environment: | ||
SPRING_DATA_MONGODB_HOST: mongo | ||
depends_on: | ||
- mongo | ||
networks: | ||
- mynetwork | ||
|
||
mongo: | ||
image: mongo:8.0 | ||
ports: | ||
- "27017:27017" | ||
environment: | ||
MONGO_INITDB_ROOT_USERNAME: admin | ||
MONGO_INITDB_ROOT_PASSWORD: admin | ||
networks: | ||
- mynetwork | ||
|
||
networks: | ||
mynetwork: |