Skip to content

Commit 5305253

Browse files
taylor-shiftcrutchcorn
authored andcommitted
deploys but images not linking due to vercel adapter
1 parent b28958d commit 5305253

File tree

8 files changed

+154
-11
lines changed

8 files changed

+154
-11
lines changed

.dockerignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# build output
2+
dist/
3+
4+
# dependencies
5+
node_modules/
6+
7+
# logs
8+
npm-debug.log*
9+
yarn-debug.log*
10+
yarn-error.log*
11+
pnpm-debug.log*
12+
13+
14+
# environment variables
15+
.env
16+
.env.production
17+
18+
# macOS-specific files
19+
.DS_Store
20+
.idea/
21+
.eslintcache
22+
.vercel
23+
.puppeteer
24+
25+
.astro
26+
.gitignore

.github/workflows/fly-deploy.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/
2+
3+
name: Fly Deploy
4+
on:
5+
push:
6+
branches:
7+
- main
8+
jobs:
9+
deploy:
10+
name: Deploy app
11+
runs-on: ubuntu-latest
12+
concurrency: deploy-group # optional: ensure only one action runs at a time
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: superfly/flyctl-actions/setup-flyctl@master
16+
- run: flyctl deploy --remote-only
17+
env:
18+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

Dockerfile

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
FROM node:20.11-slim as dependencies
2+
WORKDIR /app
3+
4+
# Install pnpm and build dependencies
5+
RUN npm install -g [email protected] && \
6+
apt-get update -qq && \
7+
apt-get install -y python3 build-essential && \
8+
rm -rf /var/lib/apt/lists/*
9+
10+
# Create the environments directory and env file FIRST
11+
RUN mkdir -p src/environments && \
12+
echo "PLAYWRIGHT_BROWSERS_PATH=/app/pw-browsers" > src/environments/browser-path.env
13+
14+
# Copy package files
15+
COPY package.json pnpm-lock.yaml ./
16+
17+
# Install dependencies and extra packages needed for content generation
18+
ENV PLAYWRIGHT_BROWSERS_PATH=/app/pw-browsers
19+
ENV HUSKY=0
20+
RUN pnpm install && \
21+
pnpm playwright install chromium
22+
23+
# Content generation stage
24+
FROM dependencies as content-builder
25+
WORKDIR /app
26+
27+
# Copy source files
28+
COPY . .
29+
30+
# Copy over the node_modules and Playwright browsers
31+
COPY --from=dependencies /app/node_modules ./node_modules
32+
COPY --from=dependencies /app/pw-browsers ./pw-browsers
33+
COPY --from=dependencies /app/src/environments/browser-path.env ./src/environments/browser-path.env
34+
35+
# First generate the content
36+
RUN pnpm run epub & pnpm run social-previews:build & wait
37+
38+
# Run just the Astro build
39+
RUN pnpm exec astro build --experimental-integrations || if [ -d "dist" ]; then \
40+
exit 0; \
41+
else \
42+
exit 1; \
43+
fi
44+
45+
# Production stage for static files
46+
FROM nginx:alpine
47+
COPY --from=content-builder /app/dist /usr/share/nginx/html
48+
49+
EXPOSE 80
50+
CMD ["nginx", "-g", "daemon off;"]

astro.config.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import sitemap from "@astrojs/sitemap";
44
import icon from "astro-icon";
55
import { EnumChangefreq as ChangeFreq } from "sitemap";
66
import { siteUrl } from "./src/constants/site-config";
7-
import vercel from "@astrojs/vercel";
87
import symlink from "symlink-dir";
98
import * as path from "path";
109
import { languages } from "./src/constants/index";
@@ -18,16 +17,15 @@ await symlink(path.resolve("content"), path.resolve("public/content"));
1817

1918
export default defineConfig({
2019
site: siteUrl,
21-
adapter: vercel({
22-
// Uses Vercel's Image Optimization API: https://vercel.com/docs/image-optimization
23-
imageService: true,
24-
imagesConfig: {
25-
sizes: SUPPORTED_IMAGE_SIZES,
26-
domains: [],
27-
formats: ["image/avif", "image/webp"],
20+
output: "static",
21+
image: {
22+
service: {
23+
entrypoint: "astro/assets/services/sharp",
24+
config: {
25+
limitInputPixels: false,
26+
},
2827
},
29-
devImageService: "sharp",
30-
}),
28+
},
3129
integrations: [
3230
icon(),
3331
preact({ compat: true }),

fly.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# fly.toml app configuration file generated for playfulprogramming-bak on 2024-12-02T18:59:27-08:00
2+
#
3+
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
4+
#
5+
6+
app = 'playfulprogramming-bak'
7+
primary_region = 'sjc'
8+
9+
[build]
10+
dockerfile = 'Dockerfile'
11+
12+
[http_service]
13+
internal_port = 80
14+
force_https = true
15+
auto_stop_machines = 'stop'
16+
auto_start_machines = true
17+
min_machines_running = 0
18+
19+
[[vm]]
20+
memory = '1gb'
21+
cpu_kind = 'shared'
22+
cpus = 1

nginx.conf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
server {
2+
listen 80;
3+
root /usr/share/nginx/html;
4+
index index.html;
5+
etag on;
6+
7+
location / {
8+
try_files $uri $uri/ /index.html;
9+
add_header Cache-Control "no-cache";
10+
}
11+
12+
# Cache static assets
13+
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ {
14+
expires 1y;
15+
add_header Cache-Control "public, no-transform";
16+
}
17+
}

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,13 @@
9090
"hast-util-heading-rank": "^3.0.0",
9191
"hast-util-to-string": "^3.0.0",
9292
"hastscript": "^9.0.0",
93+
"html-escaper": "^3.0.3",
9394
"husky": "^9.0.11",
9495
"identity-obj-proxy": "^3.0.0",
9596
"jest-location-mock": "^2.0.0",
9697
"json5": "^2.2.3",
9798
"junk": "^4.0.1",
99+
"kleur": "^4.1.5",
98100
"lint-staged": "^15.2.7",
99101
"live-server": "^1.2.2",
100102
"lru-cache": "^11.0.2",
@@ -110,6 +112,7 @@
110112
"prettier-plugin-astro": "^0.14.1",
111113
"react": "npm:@preact/[email protected]",
112114
"react-dom": "npm:@preact/[email protected]",
115+
"rehype-parse": "9.0.0",
113116
"rehype-raw": "^7.0.0",
114117
"rehype-slug-custom-id": "^2.0.0",
115118
"rehype-stringify": "^10.0.0",

pnpm-lock.yaml

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)