Skip to content

Conversation

@KTanAug21
Copy link
Contributor

Summary of changes

Create a page in the Laravel section of Fly.io docs to include a page that explains the steps needed in setting Vite environment variable!

Preview

-none please

Related Fly.io community and GitHub links

https://community.fly.io/t/how-to-setup-websocket-with-pusher-and-laravel-echo-on-deployment/19767

Notes

.env files are not included during deployment of Laravel apps in Fly.io. But since Vite reads environment variables from .env files, we need to create a temporary .env.production file in the Dockerfile's asset bundling stage using build secrets during running of fly deploy. This way, an appropriate .env file is present before building the assets and allow reading of the env variables.

This answers the issue raised by a community member here!

Copy link

@hmshwt hmshwt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your instead of You're

@KTanAug21
Copy link
Contributor Author

ALSO! This is a missing part of the docs above!

Since we need this .env.production file during build time, make sure that it's not excluded during build. Revise .dockerignore to remove that specific file exclusion:

/* .dockerignore */

// Please still exclude other .env files
.env
.env.backup

// We just need to remove the .env.production from exclusion
- .env.production

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants