From feedb59ae79f0e7b1f418aa580b67275a188dd4b Mon Sep 17 00:00:00 2001 From: Lauro Correia Silveira Date: Sun, 11 Feb 2024 00:54:09 +0100 Subject: [PATCH] Created Release 1.0.7 (#100) - Created release 1.0.7 - Fixed docker-compose and docker file - Now tests are running tih test profile --- .github/workflows/ci.yml | 2 +- Dockerfile | 7 ++++--- README.md | 32 +++++++++++++++++++++++-------- docker-compose.yml | 5 +++-- docker-compose/docker-compose.yml | 14 -------------- pom.xml | 2 +- 6 files changed, 33 insertions(+), 29 deletions(-) delete mode 100644 docker-compose/docker-compose.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c12cd62..4941ac9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: CI Workflow +name: CI/CD Workflow run-name: ${{ github.actor }} has started workflow on: push: diff --git a/Dockerfile b/Dockerfile index 1d586a4..da71a5b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,11 @@ -FROM maven:3.9.5-eclipse-temurin-21-alpine AS build +FROM maven:3.9.5-amazoncorretto-17 AS build COPY . . RUN mvn clean package -DskipTests -FROM eclipse-temurin:21-jre-alpine +FROM eclipse-temurin:17-jdk WORKDIR /alura-flix-api -COPY --from=build target/*.jar alura-flix-api.jar +ARG JAR_FILE=target/*.jar +COPY --from=build ${JAR_FILE} alura-flix-api.jar EXPOSE 8080 ENTRYPOINT ["java", "-jar", "alura-flix-api.jar"] \ No newline at end of file diff --git a/README.md b/README.md index d3b3334..9283c07 100644 --- a/README.md +++ b/README.md @@ -8,12 +8,14 @@ The application is available at: * [About](#about) * [Technologies](#Technologies) * [How to run](#how-to-run) + * [Run with Docker](#run-with-docker-compose) + * [Run with mvn spring-boot:run]() * [Authentication](#login) * [Contributors](#contributors) # About This is an application with aim to learning about new features of Spring security from Spring version 6. -It is possible to access swagger documentation throught url: [https://alura-flix-api-production.up.railway.app](https://alura-flix-api-production.up.railway.app/swagger-ui/index.html) +It is possible to access swagger documentation through url: [https://alura-flix-api-production.up.railway.app](https://alura-flix-api-production.up.railway.app/swagger-ui/index.html) The username for test is: guest@aluraflix.com and the password is: 123456, please notice this user has ROLE_USER. @@ -23,30 +25,44 @@ The username for test is: guest@aluraflix.com and the password is: 123456, pleas - Java 17 - Spring boot 3 - Spring 6 -- Mongo Atlas +- MongoDB Atlas - Lombok - Spring Security - JWT Token library - Docker +- Junit, Mockito +- Jacoco Report # How to Run -

Go to the directory docker-compose/docker-compose.yml and execute

+### Run with docker-compose +#### Before run with docker-compose - Necessary set up environments +

There's two environments variables tha should be setup:

+ +```yaml +- JWT_SECRET=${JWT_SECRET} +- DATABASE_PRO=${DATABASE_PRO} +``` +

After that it is possible to run just executing docker-compose.yml this will download the latest version

```shell docker-compose up ``` +### Run with mvn spring-boot +```shell +mvn spring-boot:run +``` #### Login -

In the authentication-controller use the credentials

-

username: guest@aluraflix.com / password: 123456 to log in.

+

In the authentication-controller use the credentials

+

username: guest@aluraflix.com / password: 123456 to log in.

![login.png](data/login.png) -

After that copy the Token JWT

+

After that copy the Token JWT

![token-jwt.png](data/token-jwt.png) -

And paste it in the Authorize button

+

And paste it in the Authorize button

![authorize-token.png](data/authorize-token.png) @@ -55,4 +71,4 @@ That's it, you are already logged and can try out all endpoints :wink: ## Contributors [@LauroSilveira](https://github.com/LauroSilveira) -

Fell free to fork and contribute :wink:

+

Fell free to fork and contribute :wink:

diff --git a/docker-compose.yml b/docker-compose.yml index 607adc6..ec69099 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,5 @@ version: '3.9' + services: alura_flix_api: image: "laurocorreia/alura-flix-api:latest" @@ -8,8 +9,8 @@ services: ports: - 8080:8080 environment: - DATABASE_PRO: ${DATABASE_PRO} - JWT_SECRET: ${JWT_SECRET} + - JWT_SECRET=${JWT_SECRET} + - DATABASE_PRO=${DATABASE_PRO} networks: compose-brigde: driver: bridge diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml deleted file mode 100644 index 8a70bb0..0000000 --- a/docker-compose/docker-compose.yml +++ /dev/null @@ -1,14 +0,0 @@ -version: '3.9' -services: - alura_flix_api: - image: "laurocorreia/alura-flix-api:1.3" - container_name: "alura_flix_api" - networks: - - compose-brigde - ports: - - 8080:8080 - env_file: - - ~/Documents/GitHub/java_challengs_back_end/alura-flix-api/.env -networks: - compose-brigde: - driver: bridge \ No newline at end of file diff --git a/pom.xml b/pom.xml index 7f4e188..dc0df54 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ com.alura alura-flix-api - 0.0.1-SNAPSHOT + 1.0.7-Release alura-flix-api An API capable to registry, delete, update and return videos.