GithubHelp home page GithubHelp logo

Comments (5)

AbdelatifAitBara avatar AbdelatifAitBara commented on July 25, 2024

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.

donkee avatar donkee commented on July 25, 2024

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.

AbdelatifAitBara avatar AbdelatifAitBara commented on July 25, 2024

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.

donkee avatar donkee commented on July 25, 2024

Hi @AbdelatifAitBara , my images are about 500MB right now.

from tokyo-free-white-nextjs-admin-dashboard.

AbdelatifAitBara avatar AbdelatifAitBara commented on July 25, 2024

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.