-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/msi-se/mobile-learning-app …
…into main
- Loading branch information
Showing
12 changed files
with
236 additions
and
28 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.env | ||
personal-playground/ | ||
.DS_Store | ||
mongo-data |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
* | ||
!target/*-runner | ||
!target/*-runner.jar | ||
!target/lib/* | ||
!target/quarkus-app/* | ||
# * | ||
# !target/*-runner | ||
# !target/*-runner.jar | ||
# !target/lib/* | ||
# !target/quarkus-app/* |
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
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
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
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
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
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,63 @@ | ||
version: "3.1" | ||
services: | ||
|
||
# mongo db | ||
mobile-learning-mongo: | ||
image: mongo | ||
container_name: mobile-learning-mongo | ||
environment: | ||
- MONGO_INITDB=mobilelearning | ||
ports: | ||
- 27017:27017 | ||
expose: | ||
- 27017 | ||
volumes: | ||
- ./mongo-data:/data/db | ||
|
||
# java quarkus backend | ||
mobile-learning-backend: | ||
build: | ||
context: ./backend | ||
dockerfile: src/main/docker/Dockerfile.jvm | ||
# dockerfile: Dockerfile | ||
container_name: mobile-learning-backend | ||
restart: always | ||
ports: | ||
- 8080:8080 | ||
depends_on: | ||
- mobile-learning-mongo | ||
environment: | ||
- MONGODB_HOST=mobile-learning-mongo | ||
- MONGODB_PORT=27017 | ||
- MONGODB_DATABASE=mobilelearning | ||
volumes: | ||
- ./backend/src/main/resources/privateKey.pem:/deployments/privateKey.pem | ||
- ./backend/src/main/resources/publicKey.pem:/deployments/publicKey.pem | ||
- ./backend/src/main/resources/application.properties:/deployments/application.properties | ||
# extra_hosts: | ||
# - "host.docker.internal:host-gateway" | ||
network_mode: "host" | ||
|
||
# flutter frontend | ||
mobile-learning-frontend: | ||
build: | ||
context: ./frontend | ||
dockerfile: Dockerfile | ||
ports: | ||
- "5000:80" | ||
container_name: mobile-learning-frontend | ||
restart: always | ||
|
||
|
||
# nginx reverse proxy | ||
mobile-learning-nginx: | ||
build: ./nginx | ||
container_name: mobile-learning-nginx | ||
environment: | ||
- MOBILE_LEARNING_BACKEND_URL=http://localhost:8080 | ||
- MOBILE_LEARNING_FRONTEND_URL=http://localhost:5000 | ||
ports: | ||
- 80:80 | ||
depends_on: | ||
- mobile-learning-backend | ||
network_mode: "host" |
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,47 @@ | ||
# Environemnt to install flutter and build web | ||
FROM debian:latest AS build-env | ||
|
||
# install all needed stuff | ||
RUN apt-get update | ||
RUN apt-get install -y curl git unzip | ||
|
||
# define variables | ||
ARG FLUTTER_SDK=/usr/local/flutter | ||
ARG FLUTTER_VERSION=3.16.7 | ||
ARG APP=/app/ | ||
|
||
#clone flutter | ||
RUN git clone https://github.com/flutter/flutter.git $FLUTTER_SDK | ||
# change dir to current flutter folder and make a checkout to the specific version | ||
RUN cd $FLUTTER_SDK && git fetch && git checkout $FLUTTER_VERSION | ||
|
||
# setup the flutter path as an enviromental variable | ||
ENV PATH="$FLUTTER_SDK/bin:$FLUTTER_SDK/bin/cache/dart-sdk/bin:${PATH}" | ||
|
||
# Start to run Flutter commands | ||
# doctor to see if all was installes ok | ||
RUN flutter doctor -v | ||
|
||
# create folder to copy source code | ||
RUN mkdir $APP | ||
# copy source code to folder | ||
COPY . $APP | ||
# stup new folder as the working directory | ||
WORKDIR $APP | ||
|
||
# Run build: 1 - clean, 2 - pub get, 3 - build web | ||
RUN flutter clean | ||
RUN flutter pub get | ||
RUN flutter build web | ||
|
||
# once heare the app will be compiled and ready to deploy | ||
|
||
# use nginx to deploy | ||
FROM nginx:1.25.2-alpine | ||
|
||
# copy the info of the builded web app to nginx | ||
COPY --from=build-env /app/build/web /usr/share/nginx/html | ||
|
||
# Expose and run nginx but on port 5000 | ||
EXPOSE 80 | ||
CMD ["nginx", "-g", "daemon off;"] |
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
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,5 @@ | ||
FROM nginx:stable | ||
|
||
COPY ./default.conf.template /etc/nginx/templates/default.conf.template | ||
|
||
EXPOSE 80 |
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,31 @@ | ||
server { | ||
listen 80; | ||
|
||
location /api { | ||
rewrite /api/(.*) /$1 break; | ||
proxy_pass ${MOBILE_LEARNING_BACKEND_URL}; | ||
proxy_redirect off; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Host $server_name; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection "upgrade"; | ||
proxy_http_version 1.1; | ||
proxy_connect_timeout 7d; | ||
proxy_send_timeout 7d; | ||
proxy_read_timeout 7d; | ||
} | ||
|
||
location / { | ||
rewrite /(.*) /$1 break; | ||
proxy_pass ${MOBILE_LEARNING_FRONTEND_URL}; | ||
proxy_redirect off; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Host $server_name; | ||
} | ||
|
||
|
||
} |