Skip to content

Commit

Permalink
Make smaller image
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonsturgeon committed Feb 7, 2024
1 parent a07b6f0 commit b2aa590
Show file tree
Hide file tree
Showing 5 changed files with 1,209 additions and 615 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ jobs:
- name: Make slim image
run: |
EXIT_CODE=0
$GITHUB_WORKSPACE/docker-slim build \
--target gmodwiki_fat:latest \
--include-path /app/dist \
Expand All @@ -56,11 +55,6 @@ jobs:
--continue-after 10 \
--show-clogs --show-blogs \
--tag ghcr.io/cfc-servers/gmodwiki:latest \
|| EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ] && [ $EXIT_CODE -ne 32 ] && [ $EXIT_CODE -ne 3 ]; then
exit $EXIT_CODE;
fi
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ RUN npm run astrobuild
FROM node:21-alpine
WORKDIR /app
COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/node_modules /app/node_modules

ENV HOST=0.0.0.0
ENV PORT=4321
ENV NODE_ENV=production
RUN npm i cookie kleur clsx cssesc server-destroy send path-to-regexp html-escaper
RUN du -sh /app/node_modules
CMD ["node", "/app/dist/server/entry.mjs"]
12 changes: 9 additions & 3 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import cloudflare from "@astrojs/cloudflare";
const buildEnv = process.env.BUILD_ENV;

let adapter;
const buildConfig = { split: true };

if (buildEnv === "production") {
console.log("Using Cloudflare adapter");
console.log("Building for Cloudflare adapter");
adapter = cloudflare({
mode: "advanced",
routes: {
Expand All @@ -27,12 +28,17 @@ if (buildEnv === "production") {
}
});
} else {
console.log("Using Node adapter");
console.log("Building for Node adapter");
adapter = node({ mode: "standalone" });

buildConfig.split = false;
buildConfig.rollupOptions = {
external: ["fs", "node:fs", "path", "node:path"]
}
}

export default defineConfig({
build: { split: true, },
build: buildConfig,
output: "server",
adapter: adapter
});
Loading

0 comments on commit b2aa590

Please sign in to comment.