Skip to content

Commit

Permalink
dockerized
Browse files Browse the repository at this point in the history
  • Loading branch information
jbhv12 committed Apr 18, 2024
1 parent 2081a67 commit 69a884f
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build and Push Docker Image

on:
push:
branches:
- main
- dev

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Check Out Repo
uses: actions/checkout@v2

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

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set Tag
run: |
if [[ $GITHUB_REF == 'refs/heads/main' ]]; then
echo "TAG=latest" >> $GITHUB_ENV
elif [[ $GITHUB_REF == 'refs/heads/dev' ]]; then
echo "TAG=dev" >> $GITHUB_ENV
fi
- name: Build and Push Docker Image
uses: docker/build-push-action@v2
with:
context: ./web-app
file: ./web-app/Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/web3-testimonials:${{ env.TAG }}

- name: Logout from DockerHub
run: docker logout
8 changes: 8 additions & 0 deletions web-app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM node:20
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["npm", "run", "start"]

0 comments on commit 69a884f

Please sign in to comment.