mirror of
https://github.com/imputnet/cobalt.git
synced 2025-06-28 01:18:27 +00:00
Merge 782045dd82
into 35530459b6
This commit is contained in:
commit
b4fef2d354
33
web/Dockerfile
Normal file
33
web/Dockerfile
Normal file
@ -0,0 +1,33 @@
|
||||
# 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;"]
|
12
web/docker-entrypoint.sh
Normal file
12
web/docker-entrypoint.sh
Normal file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Replace config placeholders with runtime values
|
||||
if [ -f "/usr/share/nginx/html/runtime-config.js" ]; then
|
||||
envsubst '${WEB_HOST} ${WEB_PLAUSIBLE_HOST} ${WEB_DEFAULT_API}' \
|
||||
< /usr/share/nginx/html/runtime-config.js \
|
||||
> /usr/share/nginx/html/runtime-config.tmp.js && \
|
||||
mv /usr/share/nginx/html/runtime-config.tmp.js /usr/share/nginx/html/runtime-config.js
|
||||
fi
|
||||
|
||||
exec "$@"
|
4
web/pnpm-workspace.yaml
Normal file
4
web/pnpm-workspace.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
packages:
|
||||
- "api"
|
||||
- "web"
|
||||
- "packages/*"
|
5
web/static/runtime-config.js
Normal file
5
web/static/runtime-config.js
Normal file
@ -0,0 +1,5 @@
|
||||
window.COBALT_CONFIG = {
|
||||
WEB_HOST: "${WEB_HOST}",
|
||||
WEB_PLAUSIBLE_HOST: "${WEB_PLAUSIBLE_HOST}",
|
||||
WEB_DEFAULT_API: "${WEB_DEFAULT_API}"
|
||||
};
|
Loading…
Reference in New Issue
Block a user