Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 14 additions & 32 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Docker stuff
Dockerfile
*.Dockerfile
*.compose.yml
*.yml

.dockerignore
.git
Expand All @@ -10,42 +10,26 @@ Dockerfile
.vscode
.github
.trunk
.claude
.kilocode
.tanstack

README.md

# from .gitignore
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
*.md

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# database
/prisma/db.sqlite
/prisma/db.sqlite-journal
db.sqlite
**/node_modules

# next.js
/.next/
/out/
next-env.d.ts

# production
/build
# build output
**/.output
**/dist
/public/wiki

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
*.log*

# local env files
# do not commit any .env files to git, except for the .env.example file. https://create.t3.gg/en/usage/env-variables#using-environment-variables
Expand All @@ -58,10 +42,8 @@ yarn-error.log*
# typescript
*.tsbuildinfo

# idea files
.idea

# schema
types/godoxy/*.json # will be generated by `make gen-schema`
# will be generated by `make gen-schema`
src/types/godoxy/*.deref.json

app/docker-compose
src/app/docker-compose
24 changes: 15 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@
/prisma/db.sqlite-journal
db.sqlite

# next.js
/.next/
/out/
next-env.d.ts

# production
/build
# build output
/.output
/.tanstack
/dist
public/wiki

# misc
.DS_Store
Expand All @@ -45,7 +43,15 @@ yarn-error.log*
# idea files
.idea

# TanStack Start

src/routeTree.gen.ts

# schema
types/godoxy/*.deref.json
src/types/godoxy/*.deref.json

src/app/docker-compose

app/docker-compose
CLAUDE.md
.kilocode/
.claude/
56 changes: 32 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,71 @@ FROM oven/bun:1.3.8-alpine AS base

HEALTHCHECK NONE

# utils stage for git and make
FROM base AS utils-deps
WORKDIR /src

# git is for building wiki (vitepress deps)
RUN apk add --no-cache git=2.49.1-r0 make=4.4.1-r3

# Install dependencies based on the preferred package manager
# wiki stage for vitepress deps
FROM utils-deps AS wiki-deps

COPY wiki/package.json wiki/bun.lock ./
RUN bun i -D --frozen-lockfile

# install dependencies into temp directory
# this will cache them and speed up future builds
FROM base AS install
# install stage for webui deps
FROM utils-deps AS install
RUN mkdir -p /temp/dev
COPY package.json bun.lock /temp/dev/
COPY juststore/package.json juststore/bun.lock /temp/dev/juststore/
WORKDIR /temp/dev
RUN bun install --frozen-lockfile

# copy node_modules from temp directory
# then copy all (non-ignored) project files into the image
FROM utils-deps AS prerelease
WORKDIR /app
COPY --from=install /temp/dev/node_modules node_modules
COPY . .
ENV NEXT_TELEMETRY_DISABLED=1
ENV NODE_ENV=production
RUN make gen-schema && bun --bun run build

# Rebuild the source code only when needed
FROM utils-deps AS wiki-builder
# build wiki
FROM wiki-deps AS wiki-builder
WORKDIR /src
COPY wiki .
RUN sed -i "s|srcDir: 'src',|srcDir: 'src', base: '/wiki',|" .vitepress/config.mts
# redirect back to GoDoxy WebUI on the same tab when pressing "Home"
ENV NODE_ENV=production
RUN sed -i "s|link: '/'|link: '/../', rel: 'noopener noreferrer', target: '_self'|" .vitepress/config.mts && \
bun --bun run docs:build

# Production image, copy all the files and run next
FROM oven/bun:1.3.8-distroless AS release
# schema-gen stage for generating schema
FROM install AS schema-gen
COPY src/types/godoxy/ ./src/types/godoxy/
COPY Makefile ./Makefile
COPY tsconfig.json ./tsconfig.json
RUN make gen-schema

# copy node_modules from temp directory
# then copy all (non-ignored) project files into the image
FROM base AS prerelease
WORKDIR /app
COPY --from=install /temp/dev/node_modules node_modules
COPY . .
RUN ln -s /app/src/components/ui /app/juststore-shadcn/src/components/ui
COPY --from=schema-gen /temp/dev/src/types/godoxy/*.json ./src/types/godoxy/

ENV NODE_ENV=production
RUN bun --bun vite build

# Production image, copy all the files and run bun
FROM oven/bun:1.3.8-distroless AS release
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1

USER 1001:1001

WORKDIR /app

COPY --from=prerelease --chown=1001:1001 /app/.next/standalone ./
COPY --from=prerelease --chown=1001:1001 /app/.next/static ./.next/static
COPY --from=prerelease --chown=1001:1001 /app/public ./public
COPY --from=wiki-builder --chown=1001:1001 /src/.vitepress/dist ./public/wiki
COPY --from=prerelease --chown=1001:1001 /app/.output ./
COPY --from=wiki-builder /src/.vitepress/dist ./public/wiki

EXPOSE 3000

ENV PORT=3000

LABEL "proxy.*.rule_file"="embed://webui.yml"

CMD ["--bun", "run", "server.js"]
CMD ["--bun", "server/index.mjs"]
27 changes: 22 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
VERSION ?= $(shell git describe --tags --abbrev=0)
BUILD_DATE ?= $(shell date -u +'%Y%m%d-%H%M')

SCHEMA_DIR := types/godoxy
BUILD_DATE ?= $(shell date -u +'%Y%m%d-%H%M%S')
PWD := $(shell pwd)
SRC_DIR := src
SCHEMA_DIR := ${SRC_DIR}/types/godoxy

.PHONY: dev

export PWD
export BUILDKIT_PROGRESS=plain

dev:
docker compose up --build --pull=never

Expand All @@ -20,6 +24,19 @@ commit-push:
update-wiki:
cd public/wiki && git pull

# emulates docker build process for wiki using git worktree (submodule)
build-wiki:
[ -d ${PWD}/public/wiki ] && rm -r ${PWD}/public/wiki || true
git -C wiki worktree add /tmp/wiki-$(BUILD_DATE) HEAD
@trap 'cd ${PWD} && git -C wiki worktree remove /tmp/wiki-$(BUILD_DATE) --force' EXIT; \
cd /tmp/wiki-$(BUILD_DATE) && \
bun i -D --frozen-lockfile && \
sed -i "s|srcDir: 'src',|srcDir: 'src', base: '/wiki',|" .vitepress/config.mts && \
sed -i "s|link: '/'|link: '/../', rel: 'noopener noreferrer', target: '_self'|" .vitepress/config.mts && \
head -n 10 .vitepress/config.mts && \
bun --bun run docs:build && \
cp -r .vitepress/dist ${PWD}/public/wiki

test-run:
docker compose -f test-run.compose.yml up --build --pull=never

Expand Down Expand Up @@ -62,5 +79,5 @@ gen-schema:
gen-schema-single

gen-docker-compose-types:
[ -f types/compose-spec.json ] || curl -o types/compose-spec.json https://raw.githubusercontent.com/compose-spec/compose-spec/main/schema/compose-spec.json
[ -f types/compose-spec.ts ] || bunx json-schema-to-typescript types/compose-spec.json types/compose-spec.ts
[ -f ${SCHEMA_DIR}/types/compose-spec.json ] || curl -o ${SCHEMA_DIR}/types/compose-spec.json https://raw.githubusercontent.com/compose-spec/compose-spec/main/schema/compose-spec.json
[ -f ${SCHEMA_DIR}/types/compose-spec.ts ] || bunx json-schema-to-typescript ${SCHEMA_DIR}/types/compose-spec.json ${SCHEMA_DIR}/types/compose-spec.ts
Binary file removed app/apple-icon.png
Binary file not shown.
5 changes: 0 additions & 5 deletions app/config/layout.tsx

This file was deleted.

17 changes: 0 additions & 17 deletions app/icon0.svg

This file was deleted.

Binary file removed app/icon1.png
Binary file not shown.
47 changes: 0 additions & 47 deletions app/layout.tsx

This file was deleted.

23 changes: 0 additions & 23 deletions app/manifest.json

This file was deleted.

Loading
Loading