Skip to content

Create docker-image.yml #11

Create docker-image.yml

Create docker-image.yml #11

Workflow file for this run

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:v$(date +%s)
docker build --progress=plain -t $IMAGE_TAG -f Dockerfile.dev .
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 }}