Update README.md #134
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Build and Push | |
# on: | |
# push: | |
# branches: [ main ] | |
on: [push] | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Create env file | |
run: | | |
touch .env | |
echo ${{secrets.DOT_ENV_FILE}} | base64 -d > .env | |
cat .env | |
- name: Build and Push Docker Base Image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./docker/Dockerfile.base | |
push: true | |
tags: aohus/virtu-mall-base:latest | |
- name: Build and Push Docker App Image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./docker/Dockerfile | |
push: true | |
tags: aohus/virtu-mall:latest | |
no-cache: true | |
# - name: Copy docker-compose.yml to Server | |
# uses: appleboy/scp-action@master | |
# with: | |
# host: ${{ secrets.AWS_EC2_HOST }} | |
# username: ${{ secrets.AWS_EC2_USERNAME }} | |
# key: ${{ secrets.AWS_EC2_SSH_KEY }} | |
# source: "docker-compose.yml" | |
# target: "/home/ubuntu" | |
# - name: Copy nginx.conf to Server | |
# uses: appleboy/scp-action@master | |
# with: | |
# host: ${{ secrets.AWS_EC2_HOST }} | |
# username: ${{ secrets.AWS_EC2_USERNAME }} | |
# key: ${{ secrets.AWS_EC2_SSH_KEY }} | |
# source: "configs/nginx.conf" | |
# target: "/home/ubuntu" | |
# - name: Deploy to AWS EC2 | |
# uses: appleboy/ssh-action@master | |
# with: | |
# host: ${{ secrets.AWS_EC2_HOST }} | |
# username: ${{ secrets.AWS_EC2_USERNAME }} | |
# key: ${{ secrets.AWS_EC2_SSH_KEY }} | |
# script: | | |
# docker-compose down | |
# docker rmi $(docker images -qa) | |
# docker pull aohus/virtu-mall | |
# docker-compose up -d |