mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
a53d50148b
## About the changes Instead of building from source (we require Node 18 but [DigitalOcean buildpack currently does not support it](https://www.digitalocean.com/community/questions/app-platform-node-build-pack-can-t-use-node-version-18)), we're going to use our Docker image from DockerHub: https://hub.docker.com/r/unleashorg/unleash-server Additionally, I realized that our Dockerfile only works in our CI (or performing a pre-build step which consists of building the frontend). With this PR I've also made a change to build the frontend if needed. That way our CI will continue to be optimal while anyone trying to build it from source will be able to do it by just running `docker build .` Closes #4261
39 lines
808 B
Docker
39 lines
808 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 --ignore-scripts && 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
|
|
|
|
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"]
|