mirror of
https://github.com/imputnet/cobalt.git
synced 2025-06-29 09:58:27 +00:00

Build and run image with ``` docker build -f web/Dockerfile -t cobalt-web . docker run -e WEB_DEFAULT_API="https://real.api.endpoint" -e WEB_HOST="http://abc" -e WEB_PLAUSIBLE_HOST="def" -p 800:80 cobalt-web ``` Currently, vite build still uses process.env env-vars at build time, so the docker container is not using those defined via placeholders in `runtime-config.js`
33 lines
574 B
Docker
33 lines
574 B
Docker
# syntax=docker/dockerfile:1
|
|
|
|
|
|
# docker build -f web/Dockerfile -t cobalt-web .
|
|
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /repo
|
|
|
|
RUN npm install -g pnpm
|
|
|
|
# Copy monorepo into container
|
|
COPY . .
|
|
|
|
# Install all deps for monorepo
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
WORKDIR /repo/web
|
|
RUN pnpm --filter ./web run build
|
|
|
|
|
|
FROM nginx:alpine
|
|
|
|
WORKDIR /usr/share/nginx/html
|
|
COPY --from=builder /repo/web/build .
|
|
|
|
COPY web/docker-entrypoint.sh /docker-entrypoint.sh
|
|
RUN chmod +x /docker-entrypoint.sh
|
|
|
|
EXPOSE 80
|
|
|
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
|
CMD ["nginx", "-g", "daemon off;"] |