Deployment question
Unanswered
Greek Harehound posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Greek HarehoundOP
How can I deploy the website without including the source codes with docker?
20 Replies
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Jersey Wooly
what does your dockerfile looks like actually ?
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Greek HarehoundOP
I don't have a docker file
I'm just asking
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Jersey Wooly
Just create your dockerfile and specify which files you are moving to your container (in your case the build folder for Next.js) `
Example :
Example :
# Use an official Node.js runtime as a base image
FROM node:14-alpine
# Set the working directory inside the container
WORKDIR /usr/src/app
# Copy package.json and package-lock.json to the working directory
COPY package*.json ./
# Install dependencies
RUN npm install --production
# Copy the built Next.js application to the container
COPY .next ./.next
# Expose the port that your application will run on
EXPOSE 3000
# Define the command to run your application
CMD ["npm", "start"]
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Greek HarehoundOP
So i should include the .next and module folders and it will work right?
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Jersey Wooly
if there is some files you want docker to ignore you can also check to use the .dockerignore file
https://docs.docker.com/language/rust/build-images/#dockerignore-file
https://docs.docker.com/language/rust/build-images/#dockerignore-file
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Greek HarehoundOP
I'm thinking of making a template and selling it and I don't want people to have the source code, do you think this method is good or is there a better method?
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Jersey Wooly
I mean yeah, since they don't have access to the source code that should be possible but regarding security idk
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile
vercel provided a good example
vercel provided a good example
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Greek HarehoundOP
thank you ray
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Greek HarehoundOP
Do I need to include pages and components directory in this example?
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
wdym?
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Greek HarehoundOP
I don't want to include source code in VPS
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
if you build with that dockerfile, it won't include any source code
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Greek HarehoundOP
I just want to
Use the .next file
and start it
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
it is
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Greek HarehoundOP
okay
thank u