Skip to content

Commit

Permalink
add ci workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
niquerio committed Oct 18, 2023
1 parent b1c6e00 commit 7067d99
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 6 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/build-deploy-on-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Deploy release

on:
release:
types: [ released ]

jobs:
build-production:
name: Build production ${{ github.event.release.tag_name }}
uses: mlibrary/platform-engineering-workflows/.github/workflows/build-production.yml@v1
with:
image_name: ${{ vars.IMAGE_NAME }}
tag: ${{ github.event.release.tag_name }}
dockerfile: Dockerfile
secrets: inherit

deploy-production:
needs: build-production
name: Deploy to production
uses: mlibrary/platform-engineering-workflows/.github/workflows/deploy.yml@v1
with:
image: ghcr.io/mlibrary/${{ vars.IMAGE_NAME }}:${{ github.event.release.tag_name }}
file: environments/browse/production/indexing-image.txt
CONFIG_REPO_RW_APP_ID: ${{ vars.CONFIG_REPO_RW_APP_ID }}
CONFIG_REPO_RW_INSTALL_ID: ${{ vars.CONFIG_REPO_RW_INSTALL_ID }}
CONFIG_REPO_FULL_NAME: ${{ vars.CONFIG_REPO_FULL_NAME }}
secrets: inherit
29 changes: 29 additions & 0 deletions .github/workflows/build-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Docker Build Main and Deploy to Workshop

on:
workflow_run:
workflows: [ 'Run Tests' ]
branches: [ main ]
types: [ completed ]

jobs:
build-unstable:
name: Build unstable ${{ github.sha }}
uses: mlibrary/platform-engineering-workflows/.github/workflows/build-unstable.yml@v1
with:
image_name: ${{ vars.IMAGE_NAME }}
tag: ${{ github.sha }}
dockerfile: Dockerfile
secrets: inherit

deploy-workshop:
needs: build-unstable
name: Deploy to workshop
uses: mlibrary/platform-engineering-workflows/.github/workflows/deploy.yml@v1
with:
image: ${{ needs.build-unstable.outputs.image }}
file: environments/browse/workshop/indexing-image.txt
CONFIG_REPO_RW_APP_ID: ${{ vars.CONFIG_REPO_RW_APP_ID }}
CONFIG_REPO_RW_INSTALL_ID: ${{ vars.CONFIG_REPO_RW_INSTALL_ID }}
CONFIG_REPO_FULL_NAME: ${{ vars.CONFIG_REPO_FULL_NAME }}
secrets: inherit
17 changes: 17 additions & 0 deletions .github/workflows/build-unstable.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Build unstable image

on:
workflow_dispatch:
inputs:
tag:
description: tag
required: true

jobs:
build-unstable:
uses: mlibrary/platform-engineering-workflows/.github/workflows/build-unstable.yml@v1
with:
image_name: ${{ vars.IMAGE_NAME }}
tag: ${{ github.event.inputs.tag }}
dockerfile: Dockerfile
secrets: inherit
30 changes: 30 additions & 0 deletions .github/workflows/manual-deploy-production.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Manual Deploy to Production

on:
workflow_dispatch:
inputs:
tag:
description: tag
required: true


jobs:
build-production:
uses: mlibrary/platform-engineering-workflows/.github/workflows/build-production.yml@v1
with:
image_name: ${{ vars.IMAGE_NAME }}
tag: ${{ github.event.inputs.tag }}
dockerfile: Dockerfile
secrets: inherit

deploy-production:
needs: build-production
name: Deploy to production
uses: mlibrary/platform-engineering-workflows/.github/workflows/deploy.yml@v1
with:
image: ghcr.io/mlibrary/${{ vars.IMAGE_NAME }}:${{ github.event.inputs.tag }}
file: environments/browse/production/indexing-image.txt
CONFIG_REPO_RW_APP_ID: ${{ vars.CONFIG_REPO_RW_APP_ID }}
CONFIG_REPO_RW_INSTALL_ID: ${{ vars.CONFIG_REPO_RW_INSTALL_ID }}
CONFIG_REPO_FULL_NAME: ${{ vars.CONFIG_REPO_FULL_NAME }}
secrets: inherit
29 changes: 29 additions & 0 deletions .github/workflows/manual-deploy-workshop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Manual Deploy to Workshop

on:
workflow_dispatch:
inputs:
tag:
description: tag
required: true

jobs:
build-unstable:
uses: mlibrary/platform-engineering-workflows/.github/workflows/build-unstable.yml@v1
with:
image_name: ${{ vars.IMAGE_NAME }}
tag: ${{ github.event.inputs.tag }}
dockerfile: Dockerfile
secrets: inherit

deploy:
needs: build-unstable
name: Deploy to workshop
uses: mlibrary/platform-engineering-workflows/.github/workflows/deploy.yml@v1
with:
image: ${{ needs.build-unstable.outputs.image }}
file: environments/browse/workshop/indexing-image.txt
CONFIG_REPO_RW_APP_ID: ${{ vars.CONFIG_REPO_RW_APP_ID }}
CONFIG_REPO_RW_INSTALL_ID: ${{ vars.CONFIG_REPO_RW_INSTALL_ID }}
CONFIG_REPO_FULL_NAME: ${{ vars.CONFIG_REPO_FULL_NAME }}
secrets: inherit
11 changes: 6 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:3.2
FROM ruby:3.2 AS development

# Check https://rubygems.org/gems/bundler/versions for the latest version.
ARG UNAME=app
Expand All @@ -10,7 +10,6 @@ RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends \
vim-tiny

RUN gem install bundler
RUN gem install sequel

RUN groupadd -g ${GID} -o ${UNAME}
RUN useradd -m -d /app -u ${UID} -g ${GID} -o -s /bin/bash ${UNAME}
Expand All @@ -23,7 +22,9 @@ ENV BUNDLE_PATH /gems

WORKDIR /app

##For a production build copy the app files and run bundle install
#COPY --chown=${UID}:${GID} . /app
#RUN bundle _${BUNDLER_VERSION}_ install
FROM development AS production

COPY --chown=${UID}:${GID} . /app

RUN bundle install

4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ version: '3'

services:
app:
build: .
build:
context: .
target: development
platform: linux/amd64
volumes:
- .:/app
Expand Down

0 comments on commit 7067d99

Please sign in to comment.