Merge pull request #2 from sBubshait/feature/CICD

Dockerisation of the front end and the backend
This commit is contained in:
Saleh Bubshait 2025-07-21 14:59:15 +03:00 committed by GitHub
commit 270228012d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 83 additions and 6 deletions

14
backend/Dockerfile Normal file
View File

@ -0,0 +1,14 @@
FROM maven:3.9.11-eclipse-temurin-21
WORKDIR /app
COPY pom.xml .
COPY application.yml .
RUN mvn dependency:go-offline -B
COPY src ./src
EXPOSE 8080
CMD ["mvn", "spring-boot:run"]

21
backend/application.yml Normal file
View File

@ -0,0 +1,21 @@
spring:
datasource:
url: ${DB_URL}
username: ${DB_USER}
password: ${DB_PASSWORD}
driver-class-name: org.postgresql.Driver
jpa:
hibernate:
ddl-auto: update
show-sql: true
properties:
hibernate:
dialect: org.hibernate.dialect.PostgreSQLDialect
format_sql: true
application:
name: wesal
server:
port: 8080

View File

@ -28,6 +28,8 @@
</scm> </scm>
<properties> <properties>
<java.version>21</java.version> <java.version>21</java.version>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
@ -96,7 +98,17 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<source>21</source>
<target>21</target>
<release>21</release>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

View File

@ -17,4 +17,21 @@ services:
depends_on: depends_on:
- db - db
ports: ports:
- 8100:8080 - 8100:8080
server:
restart: unless-stopped
build:
context: ./backend
dockerfile: Dockerfile
ports:
- 4044:8080
web:
restart: unless-stopped
build:
context: ./frontend
dockerfile: Dockerfile
ports:
- 6060:80

13
frontend/Dockerfile Normal file
View File

@ -0,0 +1,13 @@
FROM ghcr.io/cirruslabs/flutter:3.32.6 AS build
WORKDIR /app
COPY . .
RUN flutter pub get
RUN flutter build web --release
FROM nginx:alpine
COPY --from=build /app/build/web /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

View File

@ -1,10 +1,10 @@
class ApiConstants { class ApiConstants {
static const String baseUrl = 'http://localhost:8080'; static const String baseUrl = 'https://api.wesal.online';
// Auth endpoints // Auth endpoints
static const String loginEndpoint = '/login'; static const String loginEndpoint = '/login';
// User endpoints // User endpoints
static const String getUserEndpoint = '/getUser'; static const String getUserEndpoint = '/getUser';
static const String updateUserEndpoint = '/updateUser'; static const String updateUserEndpoint = '/updateUser';
} }