-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changes to deploy to openshift for PR
- Loading branch information
Showing
18 changed files
with
472 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: PR Closed | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
|
||
concurrency: | ||
# PR open and close use the same group, allowing only one at a time | ||
group: ${{ github.event.number }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
cleanup: | ||
name: Cleanup and Images | ||
uses: bcgov/quickstart-openshift-helpers/.github/workflows/[email protected] | ||
secrets: | ||
oc_namespace: ${{ secrets.OC_NAMESPACE }} | ||
oc_token: ${{ secrets.OC_TOKEN }} | ||
with: | ||
cleanup: helm | ||
packages: air-quality-statements |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Deploy to OpenShift On PR | ||
|
||
on: | ||
# Trigger the workflow every time you push to the `main` branch | ||
# Using a different branch name? Replace `main` with your branch’s name | ||
pull_request: | ||
branches: [ main ] | ||
|
||
|
||
jobs: | ||
# https://github.com/bcgov-nr/action-builder-ghcr | ||
builds: | ||
name: Builds | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
package: [air-quality-statements] | ||
timeout-minutes: 10 | ||
steps: | ||
- uses: bcgov-nr/[email protected] | ||
with: | ||
package: ${{ matrix.package }} | ||
tag: ${{ github.event.number }} | ||
tag_fallback: latest | ||
triggers: ('${{ matrix.package }}/') | ||
|
||
# https://github.com/bcgov/quickstart-openshift-helpers | ||
deploys: | ||
name: Deploys | ||
needs: [builds] | ||
uses: bcgov/quickstart-openshift-helpers/.github/workflows/[email protected] | ||
secrets: | ||
oc_namespace: ${{ secrets.OC_NAMESPACE }} | ||
oc_token: ${{ secrets.OC_TOKEN }} | ||
oc_server: ${{ vars.OC_SERVER }} | ||
with: | ||
environment: dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
auto_https off | ||
admin 0.0.0.0:3002 | ||
servers { | ||
metrics | ||
} | ||
} | ||
:3000 { | ||
log { | ||
output stdout | ||
format console { | ||
time_format iso8601 | ||
level_format color | ||
} | ||
level info | ||
} | ||
encode gzip | ||
|
||
handle { | ||
root * /app/dist | ||
try_files {path} {path}/ /index.html | ||
file_server | ||
} | ||
header { | ||
X-Frame-Options "SAMEORIGIN" | ||
X-XSS-Protection "1;mode=block" | ||
Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate" | ||
X-Content-Type-Options "nosniff" | ||
Strict-Transport-Security "max-age=31536000" | ||
Content-Security-Policy https://raw.githubusercontent.com/bcgov/* "default-src 'self' *.devops.gov.bc.ca data:; script-src 'self' 'unsafe-eval' https://www2.gov.bc.ca ;style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://use.fontawesome.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data: https://fonts.googleapis.com http://www.w3.org" | ||
Referrer-Policy "same-origin" | ||
Feature-Policy "fullscreen 'self'; camera 'none'; microphone 'none'" | ||
} | ||
} | ||
|
||
:3001 { | ||
handle /health { | ||
respond "OK" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Build static files | ||
FROM node:alpine AS build | ||
|
||
WORKDIR /app | ||
COPY . . | ||
RUN npm i --ignore-scripts && \ | ||
npm run build | ||
|
||
# Caddy | ||
FROM caddy:2.7-alpine | ||
|
||
# Copy static files and config | ||
COPY --from=build /app/build /app/dist | ||
COPY Caddyfile /etc/caddy/Caddyfile | ||
|
||
# Packages and caddy format | ||
RUN apk add --no-cache ca-certificates && \ | ||
caddy fmt --overwrite /etc/caddy/Caddyfile | ||
|
||
# Port, health check and non-root user | ||
EXPOSE 3000 3001 | ||
HEALTHCHECK --interval=30s --timeout=3s CMD curl -f http://localhost/:3001/health | ||
USER 1001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
--- | ||
import Layout from '../../layouts/Layout.astro'; | ||
--- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
apiVersion: v2 | ||
name: nr-aq-avisories | ||
description: A Helm chart for Kubernetes deployment. | ||
icon: https://www.nicepng.com/png/detail/521-5211827_bc-icon-british-columbia-government-logo.png | ||
|
||
# A chart can be either an 'application' or a 'library' chart. | ||
# | ||
# Application charts are a collection of templates that can be packaged into versioned archives | ||
# to be deployed. | ||
# | ||
# Library charts provide useful utilities or functions for the chart developer. They're included as | ||
# a dependency of application charts to inject those utilities and functions into the rendering | ||
# pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||
type: application | ||
|
||
# This is the chart version. This version number should be incremented each time you make changes | ||
# to the chart and its templates, including the app version. | ||
# Versions are expected to follow Semantic Versioning (https://semver.org/) | ||
version: 0.1.0 | ||
|
||
# This is the version number of the application being deployed. This version number should be | ||
# incremented each time you make changes to the application. Versions are not expected to | ||
# follow Semantic Versioning. They should reflect the version the application is using. | ||
# It is recommended to use it with quotes. | ||
appVersion: "1.16.0" | ||
maintainers: | ||
- name: Om Mishra | ||
email: [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "fullname" -}} | ||
{{- if .Values.fullnameOverride }} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s" .Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "name.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "labels" -}} | ||
helm.sh/chart: {{ include "name.chart" . }} | ||
{{ include "selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "fullname" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "frontend.name" -}} | ||
{{- printf "frontend" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "frontend.fullname" -}} | ||
{{- $componentName := include "frontend.name" . }} | ||
{{- if .Values.frontend.fullnameOverride }} | ||
{{- .Values.frontend.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s-%s" .Release.Name $componentName | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "frontend.labels" -}} | ||
{{ include "frontend.selectorLabels" . }} | ||
{{- if .Values.global.tag }} | ||
app.kubernetes.io/image-version: {{ .Values.global.tag | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/short-name: {{ include "frontend.name" . }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "frontend.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "frontend.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
Oops, something went wrong.