Skip to content

Added an docker-compose file for production #7

Added an docker-compose file for production

Added an docker-compose file for production #7

Workflow file for this run

name: build on docker hub and deploy to aws
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v2
- name: set up docker buildx
uses: docker/setup-buildx-action@v1
- name: log in to docker hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: build and push docker image
uses: docker/build-push-action@v2
with:
context: ./
push: true
dockerfile: ./Dockerfile
tags: taru122/lainforge-home:latest
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v2
- name: log in to docker hub
uses: docker/login-action@v1
with:
username: taru122
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: set permissions for private-key
run: |
echo "${{ secrets.AWS_PRIVATE_KEY }}" > key.pem
chmod 600 key.pem
- name: pull docker image
run: |
ssh -o StrictHostKeyChecking=no -i key.pem ubuntu@18.140.65.193 'sudo docker pull taru122/lainforge-home:latest'
- name: run the new container
run: |
ssh -o StrictHostKeyChecking=no -i key.pem ubuntu@18.140.65.193 'sudo docker run -d --name ics-dev -p 80:80 taru122/lainforge-home:latest'