update dockerfiles

This commit is contained in:
JandereDev 2022-07-12 18:07:17 +02:00
parent fe62ee88cd
commit 74a27ee00e
No known key found for this signature in database
GPG key ID: 5D5E18ACB990F57A
6 changed files with 52 additions and 36 deletions

1
.dockerignore Normal file
View file

@ -0,0 +1 @@
private/

View file

@ -1,15 +1,17 @@
FROM node:16 as build FROM node:16 as build
WORKDIR /build/ WORKDIR /build/app
COPY package.json yarn.lock .yarnrc.yml ./ COPY api/package.json api/yarn.lock api/.yarnrc.yml ./
COPY .yarn ./.yarn COPY api/.yarn ./.yarn
COPY lib ../lib
RUN yarn install --immutable RUN yarn install --immutable
COPY . . COPY ./api .
RUN yarn build RUN yarn build
FROM node:16 as prod FROM node:16 as prod
WORKDIR /app/ WORKDIR /app/api
COPY --from=build /build/package.json /build/yarn.lock /build/.yarnrc.yml ./ COPY --from=build /build/app/package.json /build/app/yarn.lock /build/app/.yarnrc.yml ./
COPY --from=build /build/.yarn ./.yarn COPY --from=build /build/app/.yarn ./.yarn
COPY --from=build /build/dist ./dist COPY --from=build /build/app/dist ./dist
COPY ./lib ../lib
RUN yarn install --immutable RUN yarn install --immutable
CMD ["yarn", "start"] CMD ["yarn", "start"]

View file

@ -1,15 +1,17 @@
FROM node:16 as build FROM node:16 as build
WORKDIR /build/ WORKDIR /build/app
COPY package.json yarn.lock .yarnrc.yml ./ COPY bot/package.json bot/yarn.lock bot/.yarnrc.yml ./
COPY .yarn ./.yarn COPY bot/.yarn ./.yarn
COPY lib ../lib
RUN yarn install --immutable RUN yarn install --immutable
COPY . . COPY ./bot .
RUN yarn build RUN yarn build
FROM node:16 as prod FROM node:16 as prod
WORKDIR /app/ WORKDIR /app/bot
COPY --from=build /build/package.json /build/yarn.lock /build/.yarnrc.yml ./ COPY --from=build /build/app/package.json /build/app/yarn.lock /build/app/.yarnrc.yml ./
COPY --from=build /build/.yarn ./.yarn COPY --from=build /build/app/.yarn ./.yarn
COPY --from=build /build/dist ./dist COPY --from=build /build/app/dist ./dist
COPY ./lib ../lib
RUN yarn install --immutable RUN yarn install --immutable
CMD ["yarn", "start"] CMD ["yarn", "start"]

View file

@ -1,15 +1,17 @@
FROM node:16 as build FROM node:16 as build
WORKDIR /build/ WORKDIR /build/app
COPY package.json yarn.lock .yarnrc.yml ./ COPY bridge/package.json bridge/yarn.lock bridge/.yarnrc.yml ./
COPY .yarn ./.yarn COPY bridge/.yarn ./.yarn
COPY lib ../lib
RUN yarn install --immutable RUN yarn install --immutable
COPY . . COPY ./bridge .
RUN yarn build RUN yarn build
FROM node:16 as prod FROM node:16 as prod
WORKDIR /app/ WORKDIR /app/bridge
COPY --from=build /build/package.json /build/yarn.lock /build/.yarnrc.yml ./ COPY --from=build /build/app/package.json /build/app/yarn.lock /build/app/.yarnrc.yml ./
COPY --from=build /build/.yarn ./.yarn COPY --from=build /build/app/.yarn ./.yarn
COPY --from=build /build/dist ./dist COPY --from=build /build/app/dist ./dist
COPY ./lib ../lib
RUN yarn install --immutable RUN yarn install --immutable
CMD ["yarn", "start"] CMD ["yarn", "start"]

View file

@ -5,7 +5,9 @@ version: "3.1"
services: services:
bot: bot:
build: ./bot build:
context: .
dockerfile: ./bot/Dockerfile
environment: environment:
- DB_HOST=mongo:27017 - DB_HOST=mongo:27017
- DB_USERNAME=mogus - DB_USERNAME=mogus
@ -33,7 +35,9 @@ services:
restart: unless-stopped restart: unless-stopped
api: api:
build: ./api build:
context: .
dockerfile: ./api/Dockerfile
environment: environment:
- BOT_API_TOKEN=${INTERNAL_API_TOKEN} - BOT_API_TOKEN=${INTERNAL_API_TOKEN}
- DB_HOST=mongo:27017 - DB_HOST=mongo:27017
@ -47,7 +51,9 @@ services:
restart: unless-stopped restart: unless-stopped
bridge: bridge:
build: ./bridge build:
context: .
dockerfile: ./bridge/Dockerfile
environment: environment:
- REVOLT_TOKEN=${BOT_TOKEN} - REVOLT_TOKEN=${BOT_TOKEN}
- DISCORD_TOKEN=${BOT_TOKEN_DISCORD} - DISCORD_TOKEN=${BOT_TOKEN_DISCORD}
@ -67,7 +73,8 @@ services:
# platform like Vercel, you can remove this part. # platform like Vercel, you can remove this part.
web: web:
build: build:
context: ./web context: .
dockerfile: ./web/Dockerfile
args: args:
- VITE_API_URL=${PUBLIC_API_URL} - VITE_API_URL=${PUBLIC_API_URL}
- VITE_BOT_PREFIX=${BOT_PREFIX} - VITE_BOT_PREFIX=${BOT_PREFIX}

View file

@ -1,18 +1,20 @@
FROM node:16 as build FROM node:16 as build
ARG VITE_API_URL ARG VITE_API_URL
ARG VITE_BOT_PREFIX ARG VITE_BOT_PREFIX
WORKDIR /build/ WORKDIR /build/app
COPY package.json yarn.lock .yarnrc.yml ./ COPY web/package.json web/yarn.lock web/.yarnrc.yml ./
COPY .yarn ./.yarn COPY web/.yarn ./.yarn
COPY lib ../lib
RUN yarn install --immutable RUN yarn install --immutable
COPY . . COPY web .
RUN yarn build RUN yarn build
FROM node:16 as prod FROM node:16 as prod
WORKDIR /app/ WORKDIR /app/web
COPY --from=build /build/package.json /build/yarn.lock /build/.yarnrc.yml ./ COPY --from=build /build/app/package.json /build/app/yarn.lock /build/app/.yarnrc.yml ./
COPY --from=build /build/.yarn ./.yarn COPY --from=build /build/app/.yarn ./.yarn
COPY --from=build /build/dist ./dist COPY --from=build /build/app/dist ./dist
COPY ./lib ../lib
RUN yarn add vite RUN yarn add vite
# Running this with bash -c because it won't exit on ctrl+c otherwise # Running this with bash -c because it won't exit on ctrl+c otherwise
CMD ["bash", "-c", "yarn preview --port=80 --strictPort=true --clearScreen=false --host"] CMD ["bash", "-c", "yarn preview --port=80 --strictPort=true --clearScreen=false --host"]