Skip to content

Commit

Permalink
Merge pull request #20 from AizuddinAkmal/stable
Browse files Browse the repository at this point in the history
Update Dockerfile to implement best practices
  • Loading branch information
Alee14 authored Apr 6, 2024
2 parents 60a0f5c + b07844b commit eeefe31
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
FROM node:alpine AS build
FROM node:latest AS build

WORKDIR /usr/src/bot

RUN apk add --update alpine-sdk libtool autoconf automake python3
RUN apt-get update && apt-get install -y build-essential libtool autoconf automake python3

COPY package.json ./

COPY yarn.lock ./

ENV NODE_ENV production

RUN yarn global add node-gyp

RUN yarn install
RUN yarn install --production

FROM node:21.7.2-bookworm-slim

ENV NODE_ENV production

RUN apt-get update && apt-get install -y dumb-init

FROM node:alpine
USER node

WORKDIR /usr/src/bot

COPY --from=build /usr/src/bot/node_modules ./node_modules
COPY --chown=node:node --from=build /usr/src/bot/node_modules ./node_modules

COPY . ./
COPY --chown=node:node . ./

CMD ["node", "bot.js"]
CMD ["dumb-init", "node", "bot.js"]

0 comments on commit eeefe31

Please sign in to comment.