Skip to content

Commit

Permalink
Bun (#31)
Browse files Browse the repository at this point in the history
* weird stuff happening with blog pages, aborting for now

* docker builds now

* after painful hours of debugging random errors im calling it for today - bun is messing up the fonts somehow

* almost ready to merge

* last few cv things
  • Loading branch information
andrioid authored Oct 4, 2024
1 parent 8fdcf74 commit 4a2bf57
Show file tree
Hide file tree
Showing 93 changed files with 1,393 additions and 11,768 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ yarn-error.log
.vercel/
dist/
.astro/
.env
.env
./app
33 changes: 14 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,37 +1,32 @@
# [Deps] Install dependencies only when needed
FROM node:18-alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app

# Install dependencies based on the preferred package manager
COPY .npmrc package.json pnpm-lock.yaml pnpm-workspace.yaml ./
RUN \
if [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm fetch; \
else echo "Lockfile not found." && exit 1; \
fi
# [1] Base Image
FROM oven/bun:1 as base

FROM base as install
COPY package.json bun.lockb ./
# Needed for workspace deps
COPY packages ./packages/
RUN bun install --frozen-lockfile

# [2] Build image (including dev deps)
FROM base as build
WORKDIR /app

COPY . .
#RUN bun install --frozen-lockfile

ARG DIRECTUS_API_TOKEN
ENV DIRECTUS_TOKEN=$DIRECTUS_API_TOKEN
ARG DIRECTUS_URL
ENV DIRECTUS_URL=$DIRECTUS_URL
RUN test -n ${DIRECTUS_API_TOKEN}
RUN test -n ${DIRECTUS_URL}



RUN pnpm install -r --offline && npm run build
RUN bun run build

# [Static] Production image, copy build assets and run the standalone node server
FROM deps as server
FROM base as server
WORKDIR /app

EXPOSE 3000
ENV HOST=0.0.0.0
ENV PORT=3000
CMD ["node", "server.mjs"]

CMD ["bun", "run", "start"]
12 changes: 6 additions & 6 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import tailwind from "@astrojs/tailwind";
import icon from "astro-icon";
import { defineConfig } from "astro/config";
import remarkEmbedImages from "remark-embed-images";

import bun from "@nurodev/astro-bun";
import node from "@astrojs/node";
import { setLayout } from "./src/lib/remark-default-layout";
import mdx from "@astrojs/mdx"
import sitemap from "@astrojs/sitemap"
import mdx from "@astrojs/mdx";
import sitemap from "@astrojs/sitemap";

export default defineConfig({
site: "https://andri.dk/",
Expand All @@ -16,12 +16,12 @@ export default defineConfig({
markdown: {
drafts: true,
remarkPlugins: [remarkEmbedImages, setLayout],
syntaxHighlight: "shiki",
shikiConfig: { theme: "github-dark" },
},
vite: {
ssr: {
external: ["svgo"],
external: ["svgo", "@react-pdf/renderer"],
noExternal: ["path-to-regexp"],
},
optimizeDeps: {
exclude: ["social-cards"], // https://github.com/evanw/esbuild/issues/1051#issuecomment-1006992549
Expand All @@ -38,7 +38,7 @@ export default defineConfig({
da: "en",
},
},
output: "server",
output: "server", // hybrid later
adapter: node({
mode: "middleware",
}),
Expand Down
Binary file added bun.lockb
Binary file not shown.
25 changes: 12 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro build",
"prebuild": "cd packages/react-cv && pnpm run build",
"predev": "pnpm run prebuild",
"dev": "bunx astro dev",
"dev:node": "bunx astro dev",
"start": "bun run ./dist/server/entry.mjs",
"build": "bunx astro build",
"sprebuild": "cd packages/react-cv && pnpm run build",
"spredev": "pnpm run prebuild",
"format": "prettier --write .",
"verify:formatting": "prettier . --check",
"preview": "astro preview",
"preview": "bunx astro preview",
"deno": "deno run --allow-net --allow-read --allow-env ./dist/server/entry.mjs",
"node": "node server.mjs",
"check": "astro check"
"check": "astro check",
"build:bin": "bun build server.mjs --compile --outfile ./app"
},
"dependencies": {
"@astrojs/mdx": "^3.1.6",
Expand All @@ -26,14 +28,14 @@
"@iconify-json/lucide": "^1.2.4",
"@iconify-json/simple-icons": "^1.2.2",
"@iconify-json/tabler": "^1.2.2",
"@nurodev/astro-bun": "^1.1.5",
"@radix-ui/react-popover": "^1.1.1",
"@react-pdf/renderer": "3.3.4",
"astro": "^4.15.6",
"astro-icon": "^1.1.1",
"express": "^4.21.0",
"markdown-it": "^13.0.2",
"markdown-it-shiki": "^0.9.0",
"react": "^18.3.1",
"react-cv": "workspace:*",
"react-dom": "^18.3.1",
"satori": "^0.10.14",
"satori-html": "^0.3.2",
Expand All @@ -50,6 +52,7 @@
"@fontsource/inter": "^5.1.0",
"@fontsource/montserrat": "~5.0.20",
"@tailwindcss/typography": "~0.5.15",
"@types/bun": "^1.1.10",
"@types/markdown-it": "^13.0.9",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
Expand All @@ -67,10 +70,6 @@
"unified": "^11.0.5",
"vfile": "^6.0.3"
},
"engines": {
"node": ">=18",
"pnpm": ">=8"
},
"workspaces": [
"packages/*"
]
Expand Down
15 changes: 0 additions & 15 deletions packages/.pnpm-debug.log

This file was deleted.

26 changes: 0 additions & 26 deletions packages/react-cv/letters/trifork.md

This file was deleted.

54 changes: 0 additions & 54 deletions packages/react-cv/package.json

This file was deleted.

Binary file removed packages/react-cv/pdf/cv.pdf
Binary file not shown.
Binary file removed packages/react-cv/pdf/letters/trifork.pdf
Binary file not shown.
22 changes: 0 additions & 22 deletions packages/react-cv/src/components/education/education-item.tsx

This file was deleted.

54 changes: 0 additions & 54 deletions packages/react-cv/src/components/experience/experience.tsx

This file was deleted.

Loading

0 comments on commit 4a2bf57

Please sign in to comment.