diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..36170a7 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +node_modules +public diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8f3b9f5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM node:20 as builder + +WORKDIR /app + +RUN npm install -g pnpm@8 +COPY . . +RUN pnpm install && pnpm build + + +# See https://lipanski.com/posts/smallest-docker-image-static-website +FROM busybox:1.36 + +RUN adduser -D static +USER static +WORKDIR /home/static + +COPY --from=builder /app/public . + +# Run BusyBox httpd +EXPOSE 3000 +CMD ["busybox", "httpd", "-f", "-v", "-p", "3000"] \ No newline at end of file diff --git a/captain-definition b/captain-definition new file mode 100644 index 0000000..0e14f82 --- /dev/null +++ b/captain-definition @@ -0,0 +1,4 @@ +{ + "schemaVersion": 2, + "dockerfilePath": "./Dockerfile" +} diff --git a/package.json b/package.json index cdf5360..9e632a9 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,7 @@ "clean": "rimraf public src/css/styles.css", "dev": "npm run clean && postcss src/css/tailwind.css > src/css/styles.css && eleventy --serve", "build": "npm run clean && NODE_ENV=production postcss src/css/tailwind.css > src/css/styles.css && eleventy", - "predeploy": "npm run build", - "deploy": "npx @getmeli/cli upload --url https://pages.sans.pub --site b9be0e93-f2e8-43f3-8d83-35cb9076fe17 --branch main --token $MELI_TOKEN ./public" + "deploy": "npx caprover deploy -a sans-pub-site -b main" }, "repository": { "type": "git",