mirror of
https://github.com/davegallant/rfd-fyi.git
synced 2025-08-07 00:58:12 +00:00
Add publish-containers workflow
This commit is contained in:
32
.github/dependabot.yml
vendored
32
.github/dependabot.yml
vendored
@@ -1,18 +1,18 @@
|
|||||||
version: 2
|
version: 2
|
||||||
updates:
|
updates:
|
||||||
- package-ecosystem: github-actions
|
- package-ecosystem: github-actions
|
||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: daily
|
interval: daily
|
||||||
reviewers:
|
reviewers:
|
||||||
- davegallant
|
- davegallant
|
||||||
assignees:
|
assignees:
|
||||||
- davegallant
|
- davegallant
|
||||||
- package-ecosystem: "docker"
|
- package-ecosystem: "docker"
|
||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: weekly
|
interval: weekly
|
||||||
reviewers:
|
reviewers:
|
||||||
- davegallant
|
- davegallant
|
||||||
assignees:
|
assignees:
|
||||||
- davegallant
|
- davegallant
|
||||||
|
83
.github/workflows/publish-containers.yml
vendored
Normal file
83
.github/workflows/publish-containers.yml
vendored
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
name: Publish Containers
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish-backend:
|
||||||
|
name: Publish rfd-fyi-backend
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
id: prep
|
||||||
|
run: |
|
||||||
|
IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/rfd-fyi-backend
|
||||||
|
VERSION=${GITHUB_REF##*/}
|
||||||
|
if [[ $GITHUB_REF == refs/heads/main ]]; then
|
||||||
|
VERSION=latest
|
||||||
|
fi
|
||||||
|
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||||
|
VERSION=${GITHUB_REF#refs/tags/v}
|
||||||
|
fi
|
||||||
|
TAGS="${IMAGE_NAME}:${VERSION}"
|
||||||
|
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
|
||||||
|
TAGS="$TAGS,${IMAGE_NAME}:latest"
|
||||||
|
fi
|
||||||
|
echo ::set-output name=tags::${TAGS}
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Login to GitHub Packages Docker Registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Push to Packages
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
context: backend
|
||||||
|
file: ./backend/Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.prep.outputs.tags }}
|
||||||
|
|
||||||
|
publish-frontend:
|
||||||
|
name: Publish rfd-fyi-frontend
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
id: prep
|
||||||
|
run: |
|
||||||
|
IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/rfd-fyi-frontend
|
||||||
|
VERSION=${GITHUB_REF##*/}
|
||||||
|
if [[ $GITHUB_REF == refs/heads/main ]]; then
|
||||||
|
VERSION=latest
|
||||||
|
fi
|
||||||
|
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||||
|
VERSION=${GITHUB_REF#refs/tags/v}
|
||||||
|
fi
|
||||||
|
TAGS="${IMAGE_NAME}:${VERSION}"
|
||||||
|
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
|
||||||
|
TAGS="$TAGS,${IMAGE_NAME}:latest"
|
||||||
|
fi
|
||||||
|
echo ::set-output name=tags::${TAGS}
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Login to GitHub Packages Docker Registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Push to Packages
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.prep.outputs.tags }}
|
9
Makefile
9
Makefile
@@ -23,11 +23,16 @@ frontend:
|
|||||||
@npx vue-cli-service serve
|
@npx vue-cli-service serve
|
||||||
.PHONY: server
|
.PHONY: server
|
||||||
|
|
||||||
## up: Build and run in docker compose
|
## dev: Build and run in docker compose
|
||||||
up:
|
dev:
|
||||||
docker compose up --build -d
|
docker compose up --build -d
|
||||||
.PHONY: up
|
.PHONY: up
|
||||||
|
|
||||||
|
## prod: Run the latest images in docker compose
|
||||||
|
prod:
|
||||||
|
docker compose -f docker-compose.prod.yml up -d
|
||||||
|
.PHONY: up
|
||||||
|
|
||||||
## teardown: Teardown docker
|
## teardown: Teardown docker
|
||||||
teardown:
|
teardown:
|
||||||
docker compose down
|
docker compose down
|
||||||
|
12
README.md
12
README.md
@@ -12,7 +12,7 @@ Ensure that an `.env` file is filled in with the appropriate values.
|
|||||||
|
|
||||||
Example key/values can be found in [example.env](./example.env).
|
Example key/values can be found in [example.env](./example.env).
|
||||||
|
|
||||||
*Note: that a [honeycomb](https://honeycomb.io/) API key is currently required.*
|
_Note: that a [honeycomb](https://honeycomb.io/) API key is currently required._
|
||||||
|
|
||||||
## Local Development
|
## Local Development
|
||||||
|
|
||||||
@@ -32,6 +32,14 @@ make frontend
|
|||||||
|
|
||||||
## Docker Compose
|
## Docker Compose
|
||||||
|
|
||||||
|
To build containers from source:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make up
|
make dev
|
||||||
|
```
|
||||||
|
|
||||||
|
To run the latest published images:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
make prod
|
||||||
```
|
```
|
||||||
|
16
docker-compose.prod.yml
Normal file
16
docker-compose.prod.yml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
version: "3.9"
|
||||||
|
services:
|
||||||
|
frontend:
|
||||||
|
image: ghcr.io/davegallant/rfd-fyi-frontend
|
||||||
|
ports:
|
||||||
|
- 80:80
|
||||||
|
- 443:443
|
||||||
|
links:
|
||||||
|
- "backend:backend"
|
||||||
|
volumes:
|
||||||
|
- ./data:/data
|
||||||
|
backend:
|
||||||
|
image: ghcr.io/davegallant/rfd-fyi-backend
|
||||||
|
ports:
|
||||||
|
- 8080:8080
|
||||||
|
env_file: .env
|
Reference in New Issue
Block a user