3bdoYasser / simple-test

0 stars 0 forks source link

openstack-ai/dockerize-app pull request #14

Closed openstack-ai[bot] closed 1 year ago

openstack-ai[bot] commented 1 year ago

CREATE Dockerfile

# Use an official Node runtime as the parent image
FROM node:14

# Set the working directory in the container to /app
WORKDIR /app

# Copy package.json and package-lock.json to the working directory
COPY package*.json ./

# Install any needed packages specified in package.json
RUN npm install

# Bundle app source inside the docker image
COPY . .

# Make port 3000 available to the world outside this container
EXPOSE 3000

# Define the command to run the app
CMD [ "npm", "start" ]

CREATE docker-compose.yml

version: '3'
services:
  app:
    build: .
    ports:
      - "3000:3000"
    volumes:
      - .:/app
    environment:
      - NODE_ENV=development

Instructions:

  1. Build the Docker image by running docker build -t simple-test . in your terminal.
  2. Run the Docker container by running docker run -p 3000:3000 simple-test.
  3. Alternatively, you can use Docker Compose to build and run the container. Run docker-compose up in your terminal.
  4. Open your web browser and navigate to http://localhost:3000 to view the app.