-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
1,663 additions
and
1,287 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Modified from https://github.com/kaogeek/kaogeek-discord-bot | ||
|
||
# ? ------------------------- | ||
# ? Builder: Complile TypeScript to JS | ||
# ? ------------------------- | ||
|
||
FROM alpine:3.20 AS node | ||
|
||
RUN apk add --no-cache nodejs npm | ||
RUN npm install -g corepack | ||
|
||
FROM node AS builder | ||
|
||
WORKDIR /app | ||
|
||
COPY package.json pnpm-lock.yaml* ./ | ||
|
||
RUN corepack enable | ||
RUN pnpm install --frozen-lockfile | ||
|
||
# copy sources | ||
COPY src ./src | ||
COPY tsconfig.json ./ | ||
|
||
# compile | ||
RUN pnpm build | ||
|
||
# ? ------------------------- | ||
# ? Deps-prod: Obtaining node_modules that contains just production dependencies | ||
# ? ------------------------- | ||
|
||
FROM node AS deps-prod | ||
|
||
WORKDIR /app | ||
|
||
COPY package.json pnpm-lock.yaml* ./ | ||
|
||
RUN corepack enable | ||
RUN pnpm install --frozen-lockfile --prod | ||
|
||
# ? ------------------------- | ||
# ? Runner: Production to run | ||
# ? ------------------------- | ||
|
||
FROM node AS runner | ||
|
||
LABEL name="bots-gulag" | ||
|
||
RUN corepack enable | ||
|
||
USER node | ||
ENV NODE_ENV production | ||
ENV ENVIRONMENT PRODUCTION | ||
|
||
# copy all files from layers above | ||
COPY package.json ./ | ||
|
||
# copy built files | ||
COPY --chown=node:node --from=deps-prod /app/node_modules ./node_modules | ||
COPY --chown=node:node --from=builder /app/dist ./dist | ||
|
||
RUN pnpm --version | ||
|
||
CMD ["pnpm", "start"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.