mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 11:30:12 +08:00
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:
1 parent
e54ae32960
commit
9aa9367f9e
17 files changed
+32
-18
No files matched your search
@@ -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" ]
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "API_TARGET=https://odyssey.wancat.cc vite",
|
"dev": "API_TARGET=https://odyssey.wancat.cc vite",
|
||||||
"dev:local": "vite",
|
"dev:local": "vite",
|
||||||
|
"dev:docker": "API_TARGET=http://backend:3000 vite",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ services:
|
|||||||
image: lancatlin/linux-odyssey:helloworld
|
image: lancatlin/linux-odyssey:helloworld
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: server/quests/helloworld/Dockerfile
|
dockerfile: quests/helloworld/Dockerfile
|
||||||
@@ -10,7 +10,7 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- 8080:80
|
- 8080:80
|
||||||
backend:
|
backend:
|
||||||
image: lancatlin/linux-odyssey
|
image: lancatlin/linux-odyssey:backend
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
|
|||||||
+14
-2
@@ -1,10 +1,20 @@
|
|||||||
version: '3'
|
version: '3'
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: app/Dockerfile.dev
|
||||||
|
ports:
|
||||||
|
- 5173:5173
|
||||||
|
networks:
|
||||||
|
- internal
|
||||||
|
volumes:
|
||||||
|
- ./app/src:/app/src
|
||||||
|
backend:
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile.dev
|
dockerfile: server/Dockerfile.dev
|
||||||
networks:
|
networks:
|
||||||
- internal
|
- internal
|
||||||
- players
|
- players
|
||||||
@@ -12,7 +22,9 @@ services:
|
|||||||
- '3000:3000'
|
- '3000:3000'
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /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:
|
environment:
|
||||||
- MONGO_URL=mongodb://db:27017/odyssey-test
|
- MONGO_URL=mongodb://db:27017/odyssey-test
|
||||||
- DOCKER_NETWORK=linux-odyssey-players
|
- DOCKER_NETWORK=linux-odyssey-players
|
||||||
|
|||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
#!/bin/sh
|
#!/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
|
WORKDIR /home/rudeus
|
||||||
|
|
||||||
COPY ./server/quests/helloworld/home /home/rudeus/
|
COPY ./quests/helloworld/home /home/rudeus/
|
||||||
|
|
||||||
CMD [ "/bin/zsh" ]
|
CMD [ "/bin/zsh" ]
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,15 +1,12 @@
|
|||||||
FROM node
|
FROM node
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package.json yarn.lock ./
|
COPY server/package.json yarn.lock ./
|
||||||
COPY server/package.json ./server/
|
|
||||||
RUN yarn install --frozen-lockfile --production
|
RUN yarn install --frozen-lockfile --production
|
||||||
|
|
||||||
WORKDIR /app/server
|
|
||||||
|
|
||||||
COPY server/src ./src
|
COPY server/src ./src
|
||||||
COPY server/quests ./quests
|
|
||||||
COPY server/swagger.yaml .
|
COPY server/swagger.yaml .
|
||||||
|
COPY quests ./quests
|
||||||
|
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
ENV HOST=0.0.0.0
|
ENV HOST=0.0.0.0
|
||||||
@@ -1,12 +1,9 @@
|
|||||||
FROM node
|
FROM node
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package.json yarn.lock ./
|
COPY server/package.json yarn.lock ./
|
||||||
COPY server/package.json ./server/
|
|
||||||
RUN yarn install --frozen-lockfile
|
RUN yarn install --frozen-lockfile
|
||||||
|
|
||||||
WORKDIR /app/server
|
|
||||||
|
|
||||||
ARG DOCKER_GID=140
|
ARG DOCKER_GID=140
|
||||||
|
|
||||||
RUN groupadd -g $DOCKER_GID docker && usermod -aG docker node
|
RUN groupadd -g $DOCKER_GID docker && usermod -aG docker node
|
||||||
@@ -17,7 +17,7 @@ const containerOptions = {
|
|||||||
Binds: config.isProduction
|
Binds: config.isProduction
|
||||||
? []
|
? []
|
||||||
: [
|
: [
|
||||||
`${projectPath}/server/quests/helloworld/home:/home/rudeus`,
|
`${projectPath}/quests/helloworld/home:/home/rudeus`,
|
||||||
`${projectPath}/packages/container:/usr/local/lib/container`,
|
`${projectPath}/packages/container:/usr/local/lib/container`,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -60,7 +60,7 @@ export async function attachContainer(container, { token }) {
|
|||||||
AttachStderr: true,
|
AttachStderr: true,
|
||||||
Cmd: ['/bin/zsh'],
|
Cmd: ['/bin/zsh'],
|
||||||
Tty: true,
|
Tty: true,
|
||||||
Env: [`TOKEN=${token}`, `API_ENDPOINT=http://app:3000`],
|
Env: [`TOKEN=${token}`, `API_ENDPOINT=http://backend:3000`],
|
||||||
})
|
})
|
||||||
|
|
||||||
const execOutput = await exec.start({
|
const execOutput = await exec.start({
|
||||||
|
|||||||
@@ -4269,7 +4269,7 @@ socket.io-adapter@~2.5.2:
|
|||||||
dependencies:
|
dependencies:
|
||||||
ws "~8.11.0"
|
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"
|
version "4.7.2"
|
||||||
resolved "https://registry.yarnpkg.com/socket.io-client/-/socket.io-client-4.7.2.tgz#f2f13f68058bd4e40f94f2a1541f275157ff2c08"
|
resolved "https://registry.yarnpkg.com/socket.io-client/-/socket.io-client-4.7.2.tgz#f2f13f68058bd4e40f94f2a1541f275157ff2c08"
|
||||||
integrity sha512-vtA0uD4ibrYD793SOIAwlo8cj6haOeMHrGvwPxJsxH7CeIksqJ+3Zc06RvWTIFgiSqx4A3sOnTXpfAEE2Zyz6w==
|
integrity sha512-vtA0uD4ibrYD793SOIAwlo8cj6haOeMHrGvwPxJsxH7CeIksqJ+3Zc06RvWTIFgiSqx4A3sOnTXpfAEE2Zyz6w==
|
||||||
|
|||||||
Reference in new issue
Block a user