Comments (5)
Hi @donkee,
I've created a Dockerfile for the version 2.0 of this solution :
# Use an official Node.js runtime as a parent image
FROM node:14-alpine
# Set the working directory to /app
WORKDIR /app
# Copy package.json and package-lock.json to the container
COPY package*.json ./
# Install dependencies
RUN apk update && apk add --no-cache nodejs npm && \
npm ci --only=production
# Copy the rest of the application code to the container
COPY . .
# Build the TypeScript code (if applicable)
RUN npm run build
# Expose the port that the application will listen on
EXPOSE 3000
# Start the application
CMD ["npm", "start"]
- You can clone the repo from here
- Then create a Dockerfile on this same folder.
- Run :
docker build -t tokyo-image .
- And to deploy the container use :
docker run -p 3000:3000 --name tokyo_container -d tokyo-image
- Browse to : localhost:3000
I hope this is gonna be helpful.
from tokyo-free-white-nextjs-admin-dashboard.
Hi @AbdelatifAitBara , thanks for commenting. This isn't a viable solution for me, however, since it still requires copying the entire project contents into the container. The NextJS Dockerfile copies some optimized files/folders that are generated when you have output
set to standalone
in the next config file. That SHOULD result in a smaller image (this is my goal, as creating the image and uploading it are taking up the majority of my build pipeline - 10+ minutes). The NextJS official solution doesn't seem to work with this project, however.
from tokyo-free-white-nextjs-admin-dashboard.
Hi @donkee,
Ok, I got you now ;) , could you tell me please the smaller image size that you have achieved ?
from tokyo-free-white-nextjs-admin-dashboard.
Hi @AbdelatifAitBara , my images are about 500MB right now.
from tokyo-free-white-nextjs-admin-dashboard.
Hi @donkee,
Yea me as well, I got the same size anyway, if I find a better solution I'll keep you on touch.
Have a good day.
from tokyo-free-white-nextjs-admin-dashboard.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tokyo-free-white-nextjs-admin-dashboard.