Skip to content

Commit

Permalink
feat: modify Dockerfile for typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
vasil-cf committed Dec 23, 2024
1 parent fcbde29 commit a385ac0
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,30 @@ RUN adduser --disabled-password -home /home/cfu -shell /bin/bash cfu
WORKDIR /root/cf-runtime
COPY package.json yarn.lock ./

FROM base AS dependencies
FROM base AS build-dependencies
RUN apt-get update \
&& apt upgrade -y \
&& apt-get install -y \
g++ \
git \
make \
python3

FROM build-dependencies AS build
RUN yarn install --frozen-lockfile
COPY . .
RUN yarn build

FROM build-dependencies AS prod-dependencies
RUN yarn install --frozen-lockfile --production

FROM base AS production
COPY --from=dependencies /root/cf-runtime/node_modules ./node_modules
COPY --from=prod-dependencies /root/cf-runtime/node_modules ./node_modules
COPY --from=build /root/cf-runtime/dist ./dist
COPY . .

#purpose of security
RUN npm -g uninstall npm

USER cfu
CMD ["node", "lib/index.js"]
CMD ["node", "dist/index.js"]

0 comments on commit a385ac0

Please sign in to comment.