Merge branch '7-create-container-environment' into 'master'

Resolve "Create Container environment"

Closes #7

See merge request marcel.schwarz/2020ss-qbc-geofence-timetracking!5
This commit is contained in:
Marcel Schwarz 2020-04-14 08:51:43 +00:00
commit c290ab8b0f
4 changed files with 54 additions and 0 deletions

10
backend/Dockerfile Normal file
View File

@ -0,0 +1,10 @@
FROM gradle:jdk11 AS build
WORKDIR /root
COPY . .
RUN ["gradle", "bootJar"]
FROM openjdk:11-jre-slim
WORKDIR /root
COPY --from=build /root/build/libs/*.jar app.jar
EXPOSE 80
ENTRYPOINT ["java", "-jar", "app.jar"]

29
docker-compose.yml Normal file
View File

@ -0,0 +1,29 @@
version: '3.7'
services:
frontend:
container_name: qbc_frontend
build:
context: ./frontend
ports:
- "8080:80"
depends_on:
- backend
backend:
container_name: qbc_backend
build:
context: ./backend
ports:
- "5000:80"
depends_on:
- db
db:
container_name: qbc_database
build:
context: ./sql
volumes:
- "./sql/db-data:/var/lib/mysql"
environment:
MYSQL_ROOT_PASSWORD: "ubc-timetracking"

2
frontend/.dockerignore Normal file
View File

@ -0,0 +1,2 @@
dist
node_modules

13
frontend/Dockerfile Normal file
View File

@ -0,0 +1,13 @@
# build stage
FROM node:12 as build-stage
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
# production stage
FROM nginx:stable-alpine as production-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]