refactor: move quests out of server

+ move quests from server/quests to ./quests
+ add frontend image in docker compose development
This commit is contained in:
wancat committed 2023-08-22 11:48:44 +08:00
1 parent e54ae32960
commit 9aa9367f9e
17 files changed
+32 -18

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
FROM node
WORKDIR /app
COPY app/package.json yarn.lock ./
RUN yarn install --frozen-lockfile
COPY app .
CMD [ "yarn", "dev:docker", "--host", "0.0.0.0" ]
+1
View File
@@ -6,6 +6,7 @@
"scripts": {
"dev": "API_TARGET=https://odyssey.wancat.cc vite",
"dev:local": "vite",
"dev:docker": "API_TARGET=http://backend:3000 vite",
"build": "vite build",
"preview": "vite preview"
},
+1 -1
View File
@@ -4,4 +4,4 @@ services:
image: lancatlin/linux-odyssey:helloworld
build:
context: .
dockerfile: server/quests/helloworld/Dockerfile
dockerfile: quests/helloworld/Dockerfile
+1 -1
View File
@@ -10,7 +10,7 @@ services:
ports:
- 8080:80
backend:
image: lancatlin/linux-odyssey
image: lancatlin/linux-odyssey:backend
restart: on-failure
build:
context: .
+14 -2
View File
@@ -1,10 +1,20 @@
version: '3'
services:
app:
build:
context: .
dockerfile: app/Dockerfile.dev
ports:
- 5173:5173
networks:
- internal
volumes:
- ./app/src:/app/src
backend:
restart: on-failure
build:
context: .
dockerfile: Dockerfile.dev
dockerfile: server/Dockerfile.dev
networks:
- internal
- players
@@ -12,7 +22,9 @@ services:
- '3000:3000'
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./server:/app/server
- ./server/src:/app/src
- ./server/swagger.yaml:/app/swagger.yaml
- ./quests:/app/quests
environment:
- MONGO_URL=mongodb://db:27017/odyssey-test
- DOCKER_NETWORK=linux-odyssey-players
+1 -1
View File
@@ -1,2 +1,2 @@
#!/bin/sh
docker compose logs app -f --no-log-prefix
docker compose -f docker-compose.prod.yml logs backend -f --no-log-prefix
File renamed without changes.
@@ -22,6 +22,6 @@ USER rudeus
WORKDIR /home/rudeus
COPY ./server/quests/helloworld/home /home/rudeus/
COPY ./quests/helloworld/home /home/rudeus/
CMD [ "/bin/zsh" ]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2 -5
View File
@@ -1,15 +1,12 @@
FROM node
WORKDIR /app
COPY package.json yarn.lock ./
COPY server/package.json ./server/
COPY server/package.json yarn.lock ./
RUN yarn install --frozen-lockfile --production
WORKDIR /app/server
COPY server/src ./src
COPY server/quests ./quests
COPY server/swagger.yaml .
COPY quests ./quests
ENV NODE_ENV=production
ENV HOST=0.0.0.0
+1 -4
View File
@@ -1,12 +1,9 @@
FROM node
WORKDIR /app
COPY package.json yarn.lock ./
COPY server/package.json ./server/
COPY server/package.json yarn.lock ./
RUN yarn install --frozen-lockfile
WORKDIR /app/server
ARG DOCKER_GID=140
RUN groupadd -g $DOCKER_GID docker && usermod -aG docker node
+2 -2
View File
@@ -17,7 +17,7 @@ const containerOptions = {
Binds: config.isProduction
? []
: [
`${projectPath}/server/quests/helloworld/home:/home/rudeus`,
`${projectPath}/quests/helloworld/home:/home/rudeus`,
`${projectPath}/packages/container:/usr/local/lib/container`,
],
},
@@ -60,7 +60,7 @@ export async function attachContainer(container, { token }) {
AttachStderr: true,
Cmd: ['/bin/zsh'],
Tty: true,
Env: [`TOKEN=${token}`, `API_ENDPOINT=http://app:3000`],
Env: [`TOKEN=${token}`, `API_ENDPOINT=http://backend:3000`],
})
const execOutput = await exec.start({
+1 -1
View File
@@ -4269,7 +4269,7 @@ socket.io-adapter@~2.5.2:
dependencies:
ws "~8.11.0"
socket.io-client@^4.7.2:
socket.io-client@^4.7.1, socket.io-client@^4.7.2:
version "4.7.2"
resolved "https://registry.yarnpkg.com/socket.io-client/-/socket.io-client-4.7.2.tgz#f2f13f68058bd4e40f94f2a1541f275157ff2c08"
integrity sha512-vtA0uD4ibrYD793SOIAwlo8cj6haOeMHrGvwPxJsxH7CeIksqJ+3Zc06RvWTIFgiSqx4A3sOnTXpfAEE2Zyz6w==