File tree Expand file tree Collapse file tree 5 files changed +24
-13
lines changed
Expand file tree Collapse file tree 5 files changed +24
-13
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,11 @@ RUN npm ci
1414# Copy source code
1515COPY . .
1616
17+ # Make start script executable
18+ RUN chmod +x start.sh
19+
1720# Set environment variables to bypass host checking
21+ ENV VITE_ALLOWED_HOSTS=all
1822ENV VITE_HOST=true
1923ENV VITE_ALLOWED_HOSTS=all
2024ENV NODE_ENV=production
@@ -29,6 +33,6 @@ RUN npm run build
2933# Expose port 8080
3034EXPOSE 8080
3135
32- # Use custom preview script for production
33- CMD ["npm" , "run" , "preview-prod " ]
36+ # Use the start script instead
37+ CMD ["./start.sh " ]
3438
Original file line number Diff line number Diff line change @@ -14,10 +14,10 @@ export default defineConfig({
1414 site,
1515 vite : {
1616 server : {
17- allowedHosts : [ 'gdg-docs-426637717447.us-central1.run.app' ] ,
17+ allowedHosts : true ,
1818 } ,
1919 preview : {
20- allowedHosts : [ 'gdg-docs-426637717447.us-central1.run.app' ] ,
20+ allowedHosts : true ,
2121 }
2222 } ,
2323 integrations : [
Original file line number Diff line number Diff line change 77 "start" : " astro dev" ,
88 "build" : " astro build" ,
99 "preview" : " astro preview" ,
10- "preview-prod" : " astro preview --host 0.0.0.0 --port 8080" ,
10+ "preview-prod" : " astro preview --host 0.0.0.0 --port 8080 --allowed-hosts gdg-docs-426637717447.us-central1.run.app " ,
1111 "astro" : " astro"
1212 },
1313 "dependencies" : {
Original file line number Diff line number Diff line change 11#! /bin/sh
2- # Start script for the container
2+ # Start script for the container with host bypass
33
4- # Use PORT environment variable if set, otherwise default to 8080
5- PORT=${PORT:- 8080}
4+ # Set environment variables to bypass host checking
5+ export VITE_ALLOWED_HOSTS=all
6+ export ASTRO_TELEMETRY_DISABLED=1
7+ export HOST=0.0.0.0
8+ export PORT=8080
69
7- echo " Starting server on port $PORT "
8- # Use astro preview instead of serve for better routing
9- npx astro preview --port $PORT --host 0.0.0.0
10+ echo " Starting Astro preview server with ALL hosts allowed..."
11+ echo " VITE_ALLOWED_HOSTS=$VITE_ALLOWED_HOSTS "
12+ echo " HOST=$HOST "
13+ echo " PORT=$PORT "
14+
15+ # Use astro preview with explicit allowed hosts bypass
16+ exec npx astro preview --host 0.0.0.0 --port 8080
Original file line number Diff line number Diff line change @@ -2,9 +2,9 @@ import { defineConfig } from 'vite';
22
33export default defineConfig ( {
44 server : {
5- allowedHosts : [ 'gdg-docs-426637717447.us-central1.run.app' ] ,
5+ allowedHosts : 'all' ,
66 } ,
77 preview : {
8- allowedHosts : [ 'gdg-docs-426637717447.us-central1.run.app' ] ,
8+ allowedHosts : 'all' ,
99 } ,
1010} ) ;
You can’t perform that action at this time.
0 commit comments