Skip to content

Commit

Permalink
Reduce Docker image size, set error handler in build script
Browse files Browse the repository at this point in the history
  • Loading branch information
penumbra23 committed May 6, 2024
1 parent ee1eee5 commit 987814c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
FROM node:21-slim AS builder
ARG MATRIX_TOKEN
ARG PACKAGE
ENV PACKAGE ${PACKAGE}
WORKDIR /code
COPY . .
RUN echo "building ${PACKAGE}... "; \
RUN set -e; \
echo "building ${PACKAGE}... "; \
yarn install; \
echo "yarn install done. Building...." ; \
yarn build; \
echo "building ${PACKAGE} done."; \
apt-get update && \
apt-get clean

FROM node:21-slim
ARG PACKAGE
ENV PACKAGE ${PACKAGE}
WORKDIR /code
COPY --from=builder /code/package.json .
COPY --from=builder /code/yarn.lock .
COPY --from=builder /code/node_modules .
COPY --from=builder /code/packages/core/build/index.js ./packages/core/build/
CMD yarn run start:js:${PACKAGE}

0 comments on commit 987814c

Please sign in to comment.