aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChristian Fehmer <[email protected]>2024-07-18 17:49:37 +0200
committerChristian Fehmer <[email protected]>2024-07-18 17:49:51 +0200
commit09fa6b4e2c9edc8419294d4fc8792323b0dab9c6 (patch)
treea644e86d94c4b00234263eb8da5dd430d8f2db70
parent898fa03cd795332decc5176017d4243ab44158d4 (diff)
downloadmonkeytype-09fa6b4e2c9edc8419294d4fc8792323b0dab9c6.tar.gz
monkeytype-09fa6b4e2c9edc8419294d4fc8792323b0dab9c6.zip
fix backend docker
-rw-r--r--SELF_HOSTING.md2
-rw-r--r--docker/BUILD.md8
-rw-r--r--docker/backend-configuration.json2
-rw-r--r--docker/backend/Dockerfile38
-rw-r--r--docker/docker-compose.yml4
5 files changed, 28 insertions, 26 deletions
diff --git a/SELF_HOSTING.md b/SELF_HOSTING.md
index 286dbe736..18aa34142 100644
--- a/SELF_HOSTING.md
+++ b/SELF_HOSTING.md
@@ -61,7 +61,7 @@ Stop the running docker containers using `docker compose down` before making any
#uncomment to enable the account system, check the SELF_HOSTING.md file
- type: bind
source: ./serviceAccountKey.json
- target: /src/credentials/serviceAccountKey.json
+ target: /app/backend/src/credentials/serviceAccountKey.json
read_only: true
```
diff --git a/docker/BUILD.md b/docker/BUILD.md
new file mode 100644
index 000000000..c63ea9c1b
--- /dev/null
+++ b/docker/BUILD.md
@@ -0,0 +1,8 @@
+## Build locally
+
+From root directoy:
+
+```
+ docker build --progress=plain --no-cache -t monkeytype/monkeytype-backend:latest . -f ./docker/backend/Dockerfile
+ docker build --progress=plain --no-cache -t monkeytype/monkeytype-frontend:latest . -f ./docker/frontend/Dockerfile
+``` \ No newline at end of file
diff --git a/docker/backend-configuration.json b/docker/backend-configuration.json
index 7c7fa8f09..1fc3cddb6 100644
--- a/docker/backend-configuration.json
+++ b/docker/backend-configuration.json
@@ -13,4 +13,4 @@
"enabled": false
}
}
-}
+} \ No newline at end of file
diff --git a/docker/backend/Dockerfile b/docker/backend/Dockerfile
index e3f5b6d2f..fc2b65343 100644
--- a/docker/backend/Dockerfile
+++ b/docker/backend/Dockerfile
@@ -1,44 +1,38 @@
-FROM node:18.20.4-alpine3.19 as builder
+
+FROM node:18.20.4-alpine3.19
+
+##install wget, used by the applyConfig script
+RUN apk add wget
WORKDIR /app
#copy
-COPY .eslintignore .eslintignore
-COPY .eslintrc.json .eslintrc.json
COPY package.json package.json
COPY package-lock.json package-lock.json
+COPY turbo.json turbo.json
COPY shared-types shared-types
+COPY packages packages
COPY backend backend
#build
RUN npm ci
-RUN cd backend && npm ci
-RUN cd backend && npm run build
+RUN npm run build
-# target
-FROM node:18.20.4-alpine3.19
-RUN apk add wget
-WORKDIR /
-COPY backend/redis-scripts /redis-scripts
-
-WORKDIR /app
-COPY backend/package.json package.json
-COPY backend/package-lock.json package-lock.json
-COPY docker/backend/entry-point.sh entry-point.sh
-COPY docker/backend/applyConfig.sh applyConfig.sh
-COPY --from=builder /app/backend/build .
-
-#install deps (no dev-dependencies)
-RUN npm ci --omit=dev
+## remove dev dependencies
+RUN npm install --install-strategy=nested --omit=dev --workspace=backend --ignore-scripts
+## to build directory
+WORKDIR /app/backend/build
## logs
RUN mkdir logs
+COPY docker/backend/entry-point.sh entry-point.sh
+COPY docker/backend/applyConfig.sh applyConfig.sh
+
#run in env mode (no anticheat)
ENV MODE=dev
-
EXPOSE 5005
USER node
-CMD [ "/bin/sh", "./entry-point.sh" ] \ No newline at end of file
+CMD [ "/bin/sh", "./entry-point.sh" ]
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
index 7f445ae07..d34a8b0d8 100644
--- a/docker/docker-compose.yml
+++ b/docker/docker-compose.yml
@@ -39,11 +39,11 @@ services:
#uncomment to enable the account system, check the SELF_HOSTING.md file
#- type: bind
# source: ./serviceAccountKey.json
- # target: /src/credentials/serviceAccountKey.json
+ # target: /app/backend/src/credentials/serviceAccountKey.json
# read_only: true
- type: bind
source: ./backend-configuration.json
- target: /app/backend-configuration.json
+ target: /app/backend/build/backend-configuration.json
read_only: true
depends_on:
monkeytype-redis: