feat: add frontend nginx image and update build workflow for both images

This commit is contained in:
Ryan Moon
2026-04-01 20:32:34 -05:00
parent 0f8aff9426
commit a73c2de26e
4 changed files with 79 additions and 2 deletions

View File

@@ -67,7 +67,7 @@ jobs:
- name: Login to registry
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login registry.lunarfront.tech -u ryan --password-stdin
- name: Build and push
- name: Build and push backend
run: |
VERSION=${{ steps.version.outputs.version }}
SHA=$(git rev-parse --short HEAD)
@@ -76,11 +76,24 @@ jobs:
-t registry.lunarfront.tech/ryan/lunarfront-app:$VERSION \
-t registry.lunarfront.tech/ryan/lunarfront-app:$SHA \
-t registry.lunarfront.tech/ryan/lunarfront-app:latest \
.
-f Dockerfile .
docker push registry.lunarfront.tech/ryan/lunarfront-app:$VERSION
docker push registry.lunarfront.tech/ryan/lunarfront-app:$SHA
docker push registry.lunarfront.tech/ryan/lunarfront-app:latest
- name: Build and push frontend
run: |
VERSION=${{ steps.version.outputs.version }}
SHA=$(git rev-parse --short HEAD)
docker build \
-t registry.lunarfront.tech/ryan/lunarfront-frontend:$VERSION \
-t registry.lunarfront.tech/ryan/lunarfront-frontend:$SHA \
-t registry.lunarfront.tech/ryan/lunarfront-frontend:latest \
-f Dockerfile.frontend .
docker push registry.lunarfront.tech/ryan/lunarfront-frontend:$VERSION
docker push registry.lunarfront.tech/ryan/lunarfront-frontend:$SHA
docker push registry.lunarfront.tech/ryan/lunarfront-frontend:latest
- name: Logout
if: always()
run: docker logout registry.lunarfront.tech

24
Dockerfile.frontend Normal file
View File

@@ -0,0 +1,24 @@
FROM oven/bun:1.3.11-alpine AS deps
WORKDIR /app
COPY package.json bun.lock ./
COPY packages/shared/package.json packages/shared/
COPY packages/admin/package.json packages/admin/
RUN bun install --frozen-lockfile
FROM oven/bun:1.3.11-alpine AS build
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY --from=deps /app/packages/shared/node_modules ./packages/shared/node_modules
COPY --from=deps /app/packages/admin/node_modules ./packages/admin/node_modules
COPY packages/shared ./packages/shared
COPY packages/admin ./packages/admin
COPY package.json ./
COPY tsconfig.base.json ./
WORKDIR /app/packages/admin
RUN bun run build
FROM nginx:alpine
COPY --from=build /app/packages/admin/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

View File

@@ -0,0 +1,11 @@
node_modules
.git
.gitea
docs
planning
deploy
infra
packages/backend
Dockerfile*
docker-compose*
*.md

29
nginx.conf Normal file
View File

@@ -0,0 +1,29 @@
server {
listen 80;
root /usr/share/nginx/html;
index index.html;
# Proxy API and WebDAV to backend
location /v1/ {
proxy_pass http://localhost:8000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /webdav/ {
proxy_pass http://localhost:8000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# SPA fallback — all other routes serve index.html
location / {
try_files $uri $uri/ /index.html;
}
}