Skip to content

Commit

Permalink
#21 Improved docker files
Browse files Browse the repository at this point in the history
  • Loading branch information
David Rauh committed Apr 26, 2023
1 parent dd8a000 commit efee101
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 4 deletions.
1 change: 1 addition & 0 deletions Dockerfile-svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ RUN npm install
COPY web-frontend/static ./static
COPY web-frontend/src ./src
COPY web-frontend/svelte.config.js web-frontend/tsconfig.json web-frontend/vite.config.ts ./
COPY web-frontend/.svelte-kit/tsconfig.json ./.svelte-kit/
RUN npm run build

FROM node:19-alpine
Expand Down
13 changes: 13 additions & 0 deletions Dockerfile-svelte-debug
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:19-alpine AS build

WORKDIR /app

COPY web-frontend/package.json ./
RUN npm install
COPY web-frontend/static ./static
COPY web-frontend/src ./src
COPY web-frontend/svelte.config.js web-frontend/tsconfig.json web-frontend/vite.config.ts ./
COPY web-frontend/.svelte-kit/tsconfig.json ./.svelte-kit/
EXPOSE 5173
ENTRYPOINT ["npm", "run", "dev","--host"]

12 changes: 10 additions & 2 deletions docker/docker-compose-debug.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,13 @@ services:
- MB_DATA_DIRECTORY
- MB_DROP_ALL
depends_on:
- postgres
- mongodb
postgres:
condition: service_healthy
mongodb:
condition: service_healthy
mb3frontend:
build:
context: ..
dockerfile: Dockerfile-svelte-debug
ports:
- "${MB3_FRONTEND_PORT}:5173"
11 changes: 11 additions & 0 deletions docker/docker-compose-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: '3.1'

services:
mb3server:
build: ../
mb3frontend:
build:
context: ..
dockerfile: Dockerfile-svelte
ports:
- "${MB3_FRONTEND_PORT}:3000"
2 changes: 2 additions & 0 deletions docker/docker-compose-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ services:
POSTGRES_PASSWORD: "mbtestpwd"
POSTGRES_USER: "mbtestuser"
POSTGRES_DB: "mbtestdb"
mb3server:
build: ../
mb3test:
build:
context: ..
Expand Down
16 changes: 15 additions & 1 deletion docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ services:
environment:
MONGO_INITDB_ROOT_USERNAME: ${MONGODB_USER}
MONGO_INITDB_ROOT_PASSWORD: ${MONGODB_PWD}
healthcheck:
test: ["CMD","mongosh", "--eval", "db.adminCommand('ping')"]
interval: 30s
timeout: 60s
retries: 5
start_period: 40s

postgres:
image: postgres:latest
Expand All @@ -16,9 +22,14 @@ services:
POSTGRES_PASSWORD: ${POSTGRES_PWD}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_DB: ${POSTGRES_DB_NAME}
healthcheck:
test: ["CMD-SHELL", "pg_isready", "-d", "${POSTGRES_DB_NAME}","-U", "${POSTGRES_USER}"]
interval: 30s
timeout: 60s
retries: 5
start_period: 40s

mb3server:
build: ../
restart: always
ports:
- "${MB3_API_PORT}:8080"
Expand All @@ -28,3 +39,6 @@ services:
depends_on:
- mongodb
- postgres

mb3frontend:
restart: always
39 changes: 39 additions & 0 deletions web-frontend/.svelte-kit/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"compilerOptions": {
"paths": {},
"rootDirs": [
"..",
"./types"
],
"importsNotUsedAsValues": "error",
"isolatedModules": true,
"preserveValueImports": true,
"lib": [
"esnext",
"DOM",
"DOM.Iterable"
],
"moduleResolution": "node",
"module": "esnext",
"target": "esnext",
"ignoreDeprecations": "5.0"
},
"include": [
"ambient.d.ts",
"./types/**/$types.d.ts",
"../vite.config.ts",
"../src/**/*.js",
"../src/**/*.ts",
"../src/**/*.svelte",
"../tests/**/*.js",
"../tests/**/*.ts",
"../tests/**/*.svelte"
],
"exclude": [
"../node_modules/**",
"./[!ambient.d.ts]**",
"../src/service-worker.js",
"../src/service-worker.ts",
"../src/service-worker.d.ts"
]
}
2 changes: 1 addition & 1 deletion web-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"dev": "vite dev --host -d",
"build": "vite build",
"preview": "vite preview",
"test": "playwright test",
Expand Down

0 comments on commit efee101

Please sign in to comment.