mirror of
https://github.com/citra-emu/discord-bot.git
synced 2024-12-22 19:15:31 +00:00
docker: update dockerfile to use rollup
This commit is contained in:
parent
749bbdeb9d
commit
0e5f158f11
|
@ -4,9 +4,9 @@ FROM node:16-alpine AS build
|
|||
WORKDIR /usr/src/app
|
||||
|
||||
# Install app dependencies and add source files
|
||||
COPY package.json yarn.lock tsconfig.json ./
|
||||
COPY src/ ./src
|
||||
RUN yarn install --frozen-lockfile && yarn build && rm -f dist/*.map
|
||||
COPY package.json env.json yarn.lock tsconfig.json bundle.sh *.js ./
|
||||
COPY ./src ./src
|
||||
RUN yarn install --frozen-lockfile && sh -e ./bundle.sh
|
||||
|
||||
# Second stage
|
||||
FROM node:16-alpine
|
||||
|
@ -15,9 +15,6 @@ WORKDIR /usr/src/app
|
|||
|
||||
# Copy artifacts
|
||||
COPY --from=build /usr/src/app/dist/ ./
|
||||
COPY --from=build /usr/src/app/node_modules ./node_modules
|
||||
COPY env.json src/responses.json ./
|
||||
COPY src/responses ./responses/
|
||||
|
||||
RUN addgroup -S app -g 50000 && \
|
||||
adduser -S -g app -u 50000 app && \
|
||||
|
|
13
bundle.sh
Executable file
13
bundle.sh
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
yarn
|
||||
|
||||
[ -d "dist" ] && rm -rf dist
|
||||
|
||||
yarn run build
|
||||
|
||||
echo "[+] Installing non-bundle-able packages ..."
|
||||
DISCORD_JS="$(grep discord.js package.json | sed 's|,||')"
|
||||
cd "dist"
|
||||
echo "{\"name\": \"citra-discord-bot\",\"license\": \"GPL-2.0+\",\"dependencies\": {${DISCORD_JS}}}" > package.json
|
||||
yarn install
|
|
@ -46,6 +46,7 @@
|
|||
"postinstall": "node generateExports.js",
|
||||
"build": "yarn run rollup -c",
|
||||
"check": "yarn run tsc --noEmit",
|
||||
"bundle": "./bundle.sh",
|
||||
"serve": "yarn run ts-node ./src/server.ts"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue