Skip to content

"Added Github Action Workflow to Automate & Dockerized React Application" #28

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

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
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
26 changes: 26 additions & 0 deletions .github/workflows/pushimage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Build and Push Docker Image
on:
push:
branches:
- main

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.G_TOKEN }}

- name: Build and Push Docker image
run: |
IMAGE_TAG=ghcr.io/rohanrusta21/github-readme:latest
docker build --file Dockerfile --tag $IMAGE_TAG .
docker push $IMAGE_TAG
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/node_modules
/.pnp
.pnp.js
package-*.json

# testing
/coverage
Expand Down
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM node:18
LABEL maintainer="Rohan Rustagi"
WORKDIR /app
COPY package.json ./
COPY package*.json ./
RUN npm install --no-optional
COPY . .
EXPOSE 3000
CMD [ "npm", "start" ]