diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2de27af..d5a830b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,14 +15,14 @@ jobs: - name: Create .env file run: | - echo MONGO_URI=${{ secrets.MONGO_URI }} >> .env echo JWT_SECRET=${{ secrets.JWT_SECRET }} >> .env + echo MONGO_URI=${{ secrets.MONGO_URI }} >> .env echo PORT=${{ vars.PORT }} >> .env - - name: List files in directory (debugging step) - run: ls -la + - name: Show project directory + run: ls -al - - name: Display .env file contents + - name: Show .env file contents run: cat .env - name: Build Docker image @@ -37,12 +37,10 @@ jobs: - name: Push Docker image to Docker Hub run: docker push kingitsolutionsteam/nawwa-test:${{ github.sha }} - deploy: runs-on: nawwa-runner - needs: build-and-push + needs: build-and-push steps: - - name: Log in to Docker Hub uses: docker/login-action@v2 with: @@ -51,9 +49,6 @@ jobs: - name: Pull Docker image run: sudo docker pull kingitsolutionsteam/nawwa-test:${{ github.sha }} - - - name: Deploy Docker image - run: | - sudo docker run -d -p ${{ vars.PORT }}:9005 kingitsolutionsteam/nawwa-test:${{ github.sha }} - + - name: Deploy Docker image + run: sudo docker run -d -p ${{ vars.PORT }}:9005 kingitsolutionsteam/nawwa-test:${{ github.sha }} diff --git a/Dockerfile b/Dockerfile index 7c2460c..e076961 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,49 +1,3 @@ -# # syntax=docker/dockerfile:1 - -# # Comments are provided throughout this file to help you get started. -# # If you need more help, visit the Dockerfile reference guide at -# # https://docs.docker.com/go/dockerfile-reference/ - -# # Want to help us make this template better? Share your feedback here: https://forms.gle/ybq9Krt8jtBL3iCk7 - -# ARG NODE_VERSION=22.11.0 - -# FROM node:${NODE_VERSION}-alpine - -# # Use production node environment by default. -# ENV NODE_ENV production -# ENV key=value - -# WORKDIR /usr/src/app - -# # Download dependencies as a separate step to take advantage of Docker's caching. -# # Leverage a cache mount to /root/.npm to speed up subsequent builds. -# # Leverage a bind mounts to package.json and package-lock.json to avoid having to copy them into -# # into this layer. -# RUN --mount=type=bind,source=package.json,target=package.json \ -# --mount=type=bind,source=package-lock.json,target=package-lock.json \ -# --mount=type=cache,target=/root/.npm \ -# npm ci --omit=dev - -# # Run the application as a non-root user. -# USER node - -# # Copy the rest of the source files into the image. -# COPY . . - -# #copy the .env file to workdir -# COPY .env . - - -# # Expose the port that the application listens on. -# EXPOSE 9005 - -# # Run the application. -# CMD ["node", "index.js"] - - -# syntax=docker/dockerfile:1 - ARG NODE_VERSION=22.11.0 FROM node:${NODE_VERSION}-alpine @@ -68,11 +22,9 @@ USER node # Copy the rest of the source files into the image. COPY . . -#copy the .env file to workdir -COPY .env . - # Expose the port that the application listens on. EXPOSE 9005 -# Run the application. -CMD ["node", "index.js"] \ No newline at end of file +# Run the application +CMD ["node", "index.js"] +