zero-ui/docker/zero-ui/Dockerfile
George Adamopoulos d52cf1ca63 Fix docker image build failure after node:lts-alpine changed to 18.
Base image for building the frontend is referenced with its tag on
the Dockerfile (FROM node:lts-alpine). The tag has been recently
changed, and now points to version 18 of nodejs.

Attempting to build with new lts (v.18), results in an error when
building the frontend:
 > [frontend-build 8/8] RUN yarn build:

Adding the ENV var has fixed the build issue, and the container image
is now produced without errors.
2022-12-22 22:23:50 +02:00

35 lines
751 B
Docker

FROM --platform=$BUILDPLATFORM node:lts-alpine as frontend-build
ENV INLINE_RUNTIME_CHUNK=false
ENV GENERATE_SOURCEMAP=false
ENV NODE_OPTIONS=--openssl-legacy-provider
WORKDIR /app/frontend
COPY yarn.lock .yarnrc.yml ./
COPY .yarn/ ./.yarn/
COPY ./frontend/package*.json /app/frontend
RUN yarn install
COPY ./frontend /app/frontend
RUN yarn build
FROM node:lts-alpine
WORKDIR /app/frontend/build
COPY --from=frontend-build /app/frontend/build /app/frontend/build/
WORKDIR /app/backend
COPY yarn.lock .yarnrc.yml ./
COPY .yarn/ ./.yarn/
COPY ./backend/package*.json /app/backend
RUN yarn install
COPY ./backend /app/backend
EXPOSE 4000
ENV NODE_ENV=production
ENV ZU_SECURE_HEADERS=true
ENV ZU_SERVE_FRONTEND=true
CMD [ "node", "./bin/www" ]