31 lines
748 B
YAML
31 lines
748 B
YAML
name: Build and Deploy
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Build Docker Image
|
|
run: |
|
|
docker build -t chesco-site:latest -f docker/Dockerfile .
|
|
|
|
- name: Deploy Container
|
|
run: |
|
|
# We use direct docker commands here because they work over the socket
|
|
# without needing files to be physically present on the host's disk.
|
|
|
|
docker stop chesco-site || true
|
|
docker rm chesco-site || true
|
|
|
|
docker run -d \
|
|
--name chesco-site \
|
|
--restart always \
|
|
-p 8081:80 \
|
|
chesco-site:latest
|