Deployment question
Unanswered
Ibizan Hound posted this in #help-forum
Ibizan HoundOP
How can I deploy the website without including the source codes with docker?
20 Replies
@Ibizan Hound How can I deploy the website without including the source codes with docker?
Jersey Wooly
what does your dockerfile looks like actually ?
Ibizan HoundOP
I don't have a docker file
I'm just asking
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"]Ibizan HoundOP
So i should include the .next and module folders and it will work right?
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
Ibizan HoundOP
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?
Jersey Wooly
I mean yeah, since they don't have access to the source code that should be possible but regarding security idk
@Ray https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile
vercel provided a good example
Ibizan HoundOP
Do I need to include pages and components directory in this example?
Ibizan HoundOP
I don't want to include source code in VPS
if you build with that dockerfile, it won't include any source code
Ibizan HoundOP
I just want to
Use the .next file
and start it
it is
Ibizan HoundOP
okay
thank u