Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solved Day 1 Issue #1 #4

Merged
merged 1 commit into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Day 1/Issue 1/Priyanshu/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:14

WORKDIR /usr/src/app

COPY package*.json ./

RUN npm install

COPY . .

COPY src ./src

EXPOSE 3000

CMD ["node", "src/index.js"]
42 changes: 42 additions & 0 deletions Day 1/Issue 1/Priyanshu/docker-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Docker CI

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build Docker image
run: docker build -t myapp:latest .

- name: Run Docker image and perform health check
run: |
container_id=$(docker run -d myapp:latest)
echo "Container started with ID: $container_id"

sleep 10

if docker exec $container_id node -e "console.log('Health check passed')"; then
echo "Health check passed"
else
echo "Health check failed"
exit 1
fi

docker stop $container_id
docker rm $container_id

- name: Cleanup
if: always()
run: |
docker image rm myapp:latest || true
Binary file added Day 1/Issue 1/Priyanshu/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.