1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/Dockerfile
Gastón Fournier a08c6f3c83
chore: remove unnecessary build (#3910)
## About the changes
This removes unnecessary build that's already triggered as part of the
prepare script
0efaa346c4/package.json (L41)

This should reduce the build time of this action:
https://github.com/Unleash/unleash/actions/workflows/docker_publish.yaml
(currently at 30m)

We can see the double execution from the log files of one execution:
```shell
$ grep " #14 " 1_build\ \(18-alpine\).txt  | grep "build:frontend" | grep built
2023-06-06T11:20:25.6513037Z #14 1198.7 [build:frontend] ✓ built in 7m 48s
2023-06-06T11:28:35.0518703Z #14 1688.1 [build:frontend] ✓ built in 7m 34s
```
_That is step 14 executing build:frontend twice_
2023-06-06 21:26:21 +02:00

36 lines
598 B
Docker

ARG NODE_VERSION=18-alpine
FROM node:$NODE_VERSION as builder
WORKDIR /unleash
COPY . /unleash
RUN yarn config set network-timeout 300000
RUN yarn install --frozen-lockfile && yarn local:package
RUN mkdir /unleash/build/frontend && cp -r /unleash/frontend/build /unleash/build/frontend/build
WORKDIR /unleash/docker
RUN yarn install --frozen-lockfile --production=true
FROM node:$NODE_VERSION
ENV NODE_ENV production
ENV TZ UTC
WORKDIR /unleash
COPY --from=builder /unleash/docker /unleash
RUN rm -rf /usr/local/lib/node_modules/npm/
EXPOSE 4242
USER node
CMD ["node", "index.js"]