update dockerfiles

This commit is contained in:
JandereDev 2022-07-12 18:07:17 +02:00
parent fe62ee88cd
commit 74a27ee00e
Signed by: Lea
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
WORKDIR /build/
COPY package.json yarn.lock .yarnrc.yml ./
COPY .yarn ./.yarn
WORKDIR /build/app
COPY api/package.json api/yarn.lock api/.yarnrc.yml ./
COPY api/.yarn ./.yarn
COPY lib ../lib
RUN yarn install --immutable
COPY . .
COPY ./api .
RUN yarn build
FROM node:16 as prod
WORKDIR /app/
COPY --from=build /build/package.json /build/yarn.lock /build/.yarnrc.yml ./
COPY --from=build /build/.yarn ./.yarn
COPY --from=build /build/dist ./dist
WORKDIR /app/api
COPY --from=build /build/app/package.json /build/app/yarn.lock /build/app/.yarnrc.yml ./
COPY --from=build /build/app/.yarn ./.yarn
COPY --from=build /build/app/dist ./dist
COPY ./lib ../lib
RUN yarn install --immutable
CMD ["yarn", "start"]

View file

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

View file

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

View file

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

View file

@ -1,18 +1,20 @@
FROM node:16 as build
ARG VITE_API_URL
ARG VITE_BOT_PREFIX
WORKDIR /build/
COPY package.json yarn.lock .yarnrc.yml ./
COPY .yarn ./.yarn
WORKDIR /build/app
COPY web/package.json web/yarn.lock web/.yarnrc.yml ./
COPY web/.yarn ./.yarn
COPY lib ../lib
RUN yarn install --immutable
COPY . .
COPY web .
RUN yarn build
FROM node:16 as prod
WORKDIR /app/
COPY --from=build /build/package.json /build/yarn.lock /build/.yarnrc.yml ./
COPY --from=build /build/.yarn ./.yarn
COPY --from=build /build/dist ./dist
WORKDIR /app/web
COPY --from=build /build/app/package.json /build/app/yarn.lock /build/app/.yarnrc.yml ./
COPY --from=build /build/app/.yarn ./.yarn
COPY --from=build /build/app/dist ./dist
COPY ./lib ../lib
RUN yarn add vite
# 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"]