Dockerize a login-page

Dockerize a login-page

·

1 min read

  1. Create a folder

  2. Clone the repository

  3. Create a docker file

  4. Build the docker image

  5. Run the image

  6. Test the project

Create a folder

Clone the repository

git clone https://github.com/Ibrahimsi/login-page.git

Create a Dockerfile

FROM node:latest

#Create app directory

WORKDIR /Users/ibrahims/Desktop/project/login-page

#Install app dependencies

#A wildcard is used to ensure both package.json AND package-lock.json are copied

#where available (npm@5+)

COPY package*.json ./

RUN npm install

#If you are building your code for production

RUN npm ci --only=production

#Bundle app source

COPY . .

EXPOSE 3005 CMD [ "npm", "start" ]

Build the docker image

Build the docker image

Run the image

docker run -p 3000:3000 -d login-page

Test the project

localhost:3000