30 lines
779 B
YAML
30 lines
779 B
YAML
name: Deploy website to Docker Container
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Install dependencies and build
|
|
run: |
|
|
npm ci
|
|
npm run production
|
|
|
|
- name: Build Docker image
|
|
run: docker build -t {{ secret.CONTAINER_IMAGE }} --build-arg SITE_DIRECTORY=dist .
|
|
|
|
- name: Remove old Docker container
|
|
run: |
|
|
docker stop {{ secret.CONTAINER_NAME }} || true && docker rm {{ secret.CONTAINER_NAME }} || true
|
|
|
|
- name: Run Docker container
|
|
run: |
|
|
docker run -d -p 8086:3000 --name {{ secret.CONTAINER_NAME }} {{ secret.CONTAINER_IMAGE }} --restart unless-stopped |