-
Notifications
You must be signed in to change notification settings - Fork 55
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
Dockerize app #79
Dockerize app #79
Conversation
Let's focus on a production build version of the svelte app and put it in a separate docker-compose file I've added a node adapter for the svelte build. I'll add some comments on your PR on how you can target the production build in the I'll note that the setup for using docker in development will be a bit different, but lets do that in a separate PR after we have the production one setup. |
docker-compose.yml
Outdated
- 5173:5173 | ||
|
||
environment: | ||
AUTH_SECRET: ${AUTH_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.
All of the environment variables will need to be exposed. See .env.example
for a list of them.
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.
All of the environment variables will need to be exposed. See
.env.example
for a list of them.
I am not really sure I understand what you mean by exposed ?!
.dockerignore
Outdated
.node_modules | ||
.husky | ||
.eslintignore | ||
.eslintrc.cjs |
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.
I'm not sure how .dockerignore
is used exactly, but for a development container (which we'll setup later), these configuration files will be needed. They will likely be mapped to a volume that mirrors this directory.
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.
I'm not sure how
.dockerignore
is used exactly, but for a development container (which we'll setup later), these configuration files will be needed. They will likely be mapped to a volume that mirrors this directory.
Do you mean you want to create a dev container where the users can open their vscode inside the container and work from there?
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.
Two containers (docker-compose) files, dev and prod versions.
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.
Two containers (docker-compose) files, dev and prod versions.
I did that in the latest commit, but I kept the configuration files ignored in .dockerignore
and every thing seems to run ok!
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.
adds a second stage to run the production app
There are several changes I need you to make, so lets just focus on the production Remove
Remove current changes to the |
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.
See comment above.
@w3cj sorry for being late, was busy lately.
but regarding this part:
couldn't we just do this: env_file:
- .env |
Thanks for this. Looks good, but the original |
I think we want to avoid doing this, because the production container likely won't have a |
@w3cj Done, could you check? |
|
||
CMD node build | ||
|
||
FROM node:18-alpine as production |
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.
Is there a reason to split the build and run into separate containers?
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.
To limit the image size?
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.
Ok seems fine then, but does there need to be an EXPOSE and CMD for the first stage? Isn't it needed for only the second container?
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.
Yeah, @kareemmahlees just remove the EXPOSE
and CMD node build
from the build stage.
What type of Pull Request is this?
Delete all options except for the one that applies
What is the current behavior?
Issue Number: #50
What is the new behavior?
Other information
I would like to hear your feedback if everything is okay before moving on to add this section to the CONTRIBUTING file