Skip to content

Commit

Permalink
Create docker-image.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
tuonghuynh11 committed Jan 26, 2024
1 parent d0604e0 commit 4065243
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
30 changes: 30 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Docker Image CI

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

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: 'Create env file'
run: echo "${{ secrets.TWITTER.ENV.DEVELOPMENT }}" >> .env.development
- name: Build the Docker image
run: |
IMAGE_TAG=hmt1/twitter:$(date +%s)
docker build . --file Dockerfile.dev --tag $IMAGE_TAG
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV
- name: Print Image Tag
run: echo ${{ env.IMAGE_TAG }}

- name: Login to Docker Hub
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Push Image to Docker Hub
run: docker push ${{ env.IMAGE_TAG }}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "",
"main": "index.js",
"scripts": {
"dev": "NODE_ENV=development npx nodemon",
"dev": "SET NODE_ENV=development & npx nodemon",
"dev:stag": "NODE_ENV=staging npx nodemon",
"dev:prod": "NODE_ENV=production npx nodemon",
"build": "rimraf ./dist && tsc && tsc-alias",
Expand Down

0 comments on commit 4065243

Please sign in to comment.