Skip to content
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

feat(deployment): docker file for vitesse #378

Merged
merged 2 commits into from
Jun 30, 2022
Merged

Conversation

Mhdi-kr
Copy link
Contributor

@Mhdi-kr Mhdi-kr commented Jun 27, 2022

Hi Anthony. I added a dockerfile for the vitesse template with adequate documentation of usage in the markdown. hope this helps,

Dockerfile Outdated Show resolved Hide resolved

WORKDIR /root/app
COPY . .
RUN pnpm i --prod
Copy link
Member

Choose a reason for hiding this comment

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

Why --prod is needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

to prevent dev dependencies to be installed. there are a lot of things we don't need such as cypress that gets installed if we don't pass that flag

Copy link
Member

Choose a reason for hiding this comment

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

But if you need to build the app, you need the dev deps. Have you tested it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes it builds fine and I could also open the instance in the browser with everything working including all the CSS.

Copy link
Member

Choose a reason for hiding this comment

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

OK. I'd trust you then

Copy link
Contributor Author

Choose a reason for hiding this comment

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

npm dependencies and devDependencies
I assumed that dev deps are only used for development phase and vitesse package json respected that information which clearly didn't, I have no Idea why it ran perfectly fine when I tested the dockerfile 3 days ago. on a fresh clone it doesn't work as @hannoeru shows it. I would recommend moving every critical build dependency from dev deps to reqular deps in package.json.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@Mhdi-kr What is the purpose of this Dockerfile? Production or Development?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is for production, I personally run my development tasks on my own machine rather than containers. @hannoeru

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

I assumed that dev deps are only used for development phase and vitesse package json respected that information which clearly didn't

because vite preview is not made for production usage, we should build vite app first then serve it as static contents, so we don't need any dependencies on production.

I have no Idea why it ran perfectly fine when I tested the dockerfile 3 days ago. on a fresh clone.

I think is because you didn't exclude node_modules from docker build, so if you installed dependencies on you local machine then build the docker container the exist dependencies will still stay there, that is why the build didn't failed.

@antfu antfu merged commit 4d6d9b9 into antfu-collective:main Jun 30, 2022
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.

3 participants