From 6ce602a3b81efc9fb2e0738e1e56d085347d9e64 Mon Sep 17 00:00:00 2001 From: OmarMagdy94 <130608904+OmarMagdy94@users.noreply.github.com> Date: Mon, 3 Jun 2024 13:48:45 +0300 Subject: [PATCH 1/6] Create Dockerfile --- Dockerfile | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..ac299606 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +# Use the official Node.js 1.0.0 image as the base image +FROM vue:5.0.0 + +# Set the working directory in the container +WORKDIR /usr/src/app + +# Copy package.json and package-lock.json to the working directory +COPY package*.json ./ + +# Install the application dependencies +RUN npm install + +# Copy the rest of the application code to the working directory +COPY . . + +# Expose the port the app runs on +EXPOSE 6000 + +# Command to run the application +CMD ["vue", "index.js"] From 2444e7dcc7956ca5879b883007142e8ccfbd0790 Mon Sep 17 00:00:00 2001 From: OmarMagdy94 <130608904+OmarMagdy94@users.noreply.github.com> Date: Mon, 3 Jun 2024 16:10:46 +0300 Subject: [PATCH 2/6] Update Dockerfile --- Dockerfile | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index ac299606..da97dc62 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,29 @@ -# Use the official Node.js 1.0.0 image as the base image -FROM vue:5.0.0 +# Use the official Node.js image as the base image +FROM node:14 -# Set the working directory in the container -WORKDIR /usr/src/app +# Set the working directory inside the container +WORKDIR /app -# Copy package.json and package-lock.json to the working directory +# Copy the package.json and package-lock.json to the working directory COPY package*.json ./ -# Install the application dependencies +# Install the dependencies RUN npm install -# Copy the rest of the application code to the working directory +# Copy the rest of the application files to the working directory COPY . . -# Expose the port the app runs on -EXPOSE 6000 +# Build the Vue.js application for production +RUN npm run build -# Command to run the application -CMD ["vue", "index.js"] +# Use the official Nginx image to serve the Vue.js application +FROM nginx:alpine + +# Copy the built files from the previous stage to the Nginx web directory +COPY --from=0 /app/dist /usr/share/nginx/html + +# Expose port 80 +EXPOSE 80 + +# Start Nginx +CMD ["nginx", "-g", "daemon off;"] From 313348ed7602164181528af4877107b040dc99a0 Mon Sep 17 00:00:00 2001 From: OmarMagdy94 <130608904+OmarMagdy94@users.noreply.github.com> Date: Mon, 3 Jun 2024 16:22:28 +0300 Subject: [PATCH 3/6] Update Dockerfile 1 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index da97dc62..7eab78e6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Use the official Node.js image as the base image -FROM node:14 +FROM node:5.0.0 # Set the working directory inside the container WORKDIR /app From de3b521b040a8180afdac3d85eb9b7a11c5721b3 Mon Sep 17 00:00:00 2001 From: OmarMagdy94 <130608904+OmarMagdy94@users.noreply.github.com> Date: Mon, 3 Jun 2024 17:03:11 +0300 Subject: [PATCH 4/6] Create omar.yml --- .github/workflows/omar.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/omar.yml diff --git a/.github/workflows/omar.yml b/.github/workflows/omar.yml new file mode 100644 index 00000000..864b28ba --- /dev/null +++ b/.github/workflows/omar.yml @@ -0,0 +1,24 @@ +name: build and push to docker-hub +on: + push: + branches: + - omar +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: omar8magdy + password: "${{ secrets.DOCKERHUB_TOKEN }}" + + - name: Build Docker image + run: | + docker build -t omar . + docker tag omar omar8magdy/nodejs-test:omar + docker push omar8magdy/nodejs-test:omar + From 69470be31808de4cc9bdf7afa9344b4920f6713b Mon Sep 17 00:00:00 2001 From: OmarMagdy94 <130608904+OmarMagdy94@users.noreply.github.com> Date: Tue, 4 Jun 2024 14:39:50 +0300 Subject: [PATCH 5/6] Update omar.yml 1 From 9d648bd415eb8f4806eedfa9ecbe44f9ca7c941a Mon Sep 17 00:00:00 2001 From: OmarMagdy94 <130608904+OmarMagdy94@users.noreply.github.com> Date: Wed, 5 Jun 2024 21:01:29 +0300 Subject: [PATCH 6/6] Update omar.yml 1