1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00
unleash.unleash/Dockerfile
Christopher Kolstad f8f7b55a53
task: Remove docker package setup. (#8959)
Keeping the index.js inside the docker folder to avoid our tsconfig
having to be changed. In addition, updated the build to copy less of the
folders into our final image, since we really only needed build and
node_modules.

Should reduce attack surface of the container.
2024-12-11 13:50:38 +01:00

41 lines
844 B
Docker

ARG NODE_VERSION=20.18.1-alpine
FROM node:$NODE_VERSION AS builder
WORKDIR /unleash
COPY . /unleash
RUN corepack enable
RUN yarn install --immutable && yarn prepare:backend && yarn local:package
# frontend/build should already exist (it needs to be built in the local filesystem but in case of a fresh build we'll build it here)
RUN yarn build:frontend:if-needed
RUN mkdir -p /unleash/build/frontend && mv /unleash/frontend/build /unleash/build/frontend/build
RUN yarn workspaces focus -A --production
FROM node:$NODE_VERSION
ENV NODE_ENV=production
ENV TZ=UTC
WORKDIR /unleash
COPY --from=builder /unleash/build /unleash/build
COPY --from=builder /unleash/node_modules /unleash/node_modules
COPY ./docker/index.js /unleash/index.js
RUN rm -rf /usr/local/lib/node_modules/npm/
EXPOSE 4242
USER node
CMD ["node", "index.js"]