FROM node:lts AS development ARG service COPY . /opt/${service} WORKDIR /opt/${service} RUN npm install && npm install -g vite CMD vite dev --port=80 --host=0.0.0.0 --strictPort --logLevel info FROM node:lts AS build ARG service ARG origin=https://admin.barretthousen.com ENV PROTOCOL_HEADER=x-forwarded-proto ENV HOST_HEADER=x-forwarded-host ENV ORIGIN=${origin} WORKDIR /opt/${service} COPY . /opt/${service} RUN npm ci && npm run build \ && cp -v /opt/${service}/package.json /opt/${service}/build \ && cp -v /opt/${service}/package-lock.json /opt/${service}/build \ && cd /opt/${service}/build && npm ci --omit dev FROM node:lts AS production ARG service LABEL com.barretthousen.service=${service} LABEL com.barretthousen.tags="frontend,public" LABEL com.barretthousen.release-date="2023-05-01" LABEL com.barretthousen.version="alpha-0.0.1" LABEL com.barretthousen.git-ref="000000000000000000000000000000000000000000000000" ARG origin=https://admin.barretthousen.com ENV ENV=production ENV PROTOCOL_HEADER=x-forwarded-proto ENV HOST_HEADER=x-forwarded-host ENV SERVICE=${service} ENV ORIGIN=${origin} WORKDIR /opt COPY --from=build /opt/${service}/build/ /opt/${service}/ ENV PORT 80 EXPOSE 80 ENTRYPOINT ["node", ${SERVICE}]