-
Notifications
You must be signed in to change notification settings - Fork 8
Production-ready Docker Compose setup: env handling, volumes, and documentation #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Production-ready Docker Compose setup: env handling, volumes, and documentation #23
Conversation
| ports: | ||
| - "3000:3000" | ||
| environment: | ||
| - JWT_SECRET=${JWT_SECRET} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future, we will add more environment variables, so we will need to use the .env file.
| ports: | ||
| - "5173:80" | ||
| environment: | ||
| - VITE_API_URL=${VITE_API_URL} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future, we will add more environment variables, so we will need to use the .env file to pass the values
| @@ -0,0 +1 @@ | |||
| JWT_SECRET="YOUR_SECRET" No newline at end of file | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need only a single .env file in the root, both for the frontend and the backend.
| @@ -0,0 +1 @@ | |||
| VITE_API_URL="http://localhost:3000" No newline at end of file | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need only a single .env file in the root, both for the frontend and the backend.
| // Generate the magic link (modify sendMagicLink to return the link) | ||
| // const magicLink = await this.authService.sendMagicLink(email); | ||
| const mockMode = process.env.MOCK_EMAIL_ENABLED === 'true'; | ||
| const magicLink = await this.authService.sendMagicLink(email, mockMode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sendMagicLink(email, mockMode) only accepts email as an argument You did not implement the sendmagicLink funtion
|
Are you testing this before raising the PR? |
Description
Key Changes
Add
.dockerignorenode_modules,.env,dist,.git, logs) from being copied into Docker images, resulting in smaller, faster builds.Refactor Frontend for Configurable Backend URL
VITE_API_URLenvironment variable instead of hardcodinglocalhost.Remove
COPY .envfrom Dockerfiles.envfiles into images.Pass Backend Environment Variables via Docker Compose
JWT_SECRETandBACKEND_PORTvia Compose, not baked into the image..envfiles provided for both frontend and backend.Persist SQLite Database with Docker Volume
sqlite-data) to persist the SQLite database, ensuring data is not lost on container restarts.Update
README.mdwith Production Deployment Instructions.envis used by Compose for variable substitution and is not copied into images.Closes #2