Skip to content

Commit

Permalink
Merge branch 'main' of github.com:tharaka911/nawwa-node-socketio-mong…
Browse files Browse the repository at this point in the history
…o-api
  • Loading branch information
tharaka911 committed Nov 26, 2024
2 parents 9011ec8 + d0952fe commit 3b95501
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 63 deletions.
19 changes: 7 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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 }}
54 changes: 3 additions & 51 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"]
# Run the application
CMD ["node", "index.js"]

0 comments on commit 3b95501

Please sign in to comment.