Skip to content
Open
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
13 changes: 1 addition & 12 deletions .github/workflows/monograph.publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,12 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v4

- name: Setup Node
uses: ./.github/actions/setup-node-with-cache

- name: Install packages
run: |
npm ci --ignore-scripts --prefer-offline --no-audit
npm run bootstrap -- --scope=monograph

- name: Collect package metadata
id: package_metadata
working-directory: ./apps/monograph
run: |
echo ::set-output name=app_version::$(cat package.json | jq -r .version)

- name: Generate build
run: npx nx build @notesnook/monograph

# Setup Buildx
- name: Docker Setup Buildx
uses: docker/setup-buildx-action@v3
Expand Down Expand Up @@ -74,7 +63,7 @@ jobs:
id: push
uses: docker/build-push-action@v6
with:
context: apps/monograph
context: .
file: apps/monograph/Dockerfile
push: true
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v8
Expand Down
29 changes: 25 additions & 4 deletions apps/monograph/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@
# Build stage
FROM node:20-alpine AS build

FROM oven/bun:1.2.2-alpine
# Install dependencies for gyp to work
RUN --mount=type=cache,target=/var/cache/apk,sharing=locked apk add --update build-base git python3 py3-setuptools

RUN mkdir -p /home/bun/app && chown -R bun:bun /home/bun/app
WORKDIR /app

# Copy files
COPY . .

# Install dependencies
RUN --mount=type=cache,target=/root/.npm npm ci --ignore-scripts --prefer-offline --no-audit

# Bootstrap the project
RUN --mount=type=cache,target=/root/.npm npm run bootstrap -- --scope=monograph

# Build the application
RUN npx nx build @notesnook/monograph

# Production stage
FROM oven/bun:1.2.2-alpine AS production

# Copy built files from build stage
WORKDIR /home/bun/app
COPY --chown=bun:bun --from=build /app/apps/monograph/output .

# Set the user to bun
RUN chown -R bun:bun /home/bun/app
USER bun

COPY --chown=bun:bun output .

# Install server dependencies
RUN bun install

CMD [ "bun", "run", "start" ]