Skip to content

Commit

Permalink
feat: node consistency (#1355)
Browse files Browse the repository at this point in the history
  • Loading branch information
DerekRoberts authored Sep 12, 2023
1 parent 5fcac58 commit 9c12a8e
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 134 deletions.
50 changes: 21 additions & 29 deletions .github/workflows/merge-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,45 @@ concurrency:

jobs:
deploys-test:
name: TEST Deployments
name: TEST Deploys
environment: test
runs-on: ubuntu-22.04
strategy:
matrix:
name:
- backend
- database
- frontend
- init
- database
- backend
- backend-go
- backend-java
- backend-py
- backend-go
- frontend
include:
- name: init
file: common/openshift.init.yml
overwrite: false
- name: database
file: database/openshift.deploy.yml
overwrite: false
- name: backend
file: backend/openshift.deploy.yml
parameters: -p PROMOTE_MIGRATION=${{ github.repository }}/database-migrations:test
overwrite: true
verification_path: /api
- name: database
file: database/openshift.deploy.yml
overwrite: false
- name: frontend
file: frontend/openshift.deploy.yml
- name: backend-go
file: backend-go/openshift.deploy.yml
overwrite: true
parameters: -p PROMOTE_MIGRATION=${{ github.repository }}/database-migrations-go:test
- name: backend-java
file: backend-java/openshift.deploy.yml
overwrite: true
- name: init
file: common/openshift.init.yml
overwrite: false
- name: backend-py
file: backend-py/openshift.deploy.yml
overwrite: true
parameters: -p PROMOTE_MIGRATION=${{ github.repository }}/database-migrations-py:test
- name: backend-java
file: backend-java/openshift.deploy.yml
overwrite: true
- name: backend-go
file: backend-go/openshift.deploy.yml
- name: frontend
file: frontend/openshift.deploy.yml
overwrite: true
parameters: -p PROMOTE_MIGRATION=${{ github.repository }}/database-migrations-go:test
steps:
- uses: bcgov-nr/[email protected]
with:
Expand Down Expand Up @@ -168,24 +168,16 @@ jobs:
- database-migrations-go
- database-migrations-py
steps:
- name: Delete all untagged
uses: actions/delete-package-versions@v4
with:
package-name: "${{ github.event.repository.name }}/${{ matrix.name }}"
package-type: "container"
min-versions-to-keep: 0
delete-only-untagged-versions: "true"

- name: Keep last 10
uses: actions/delete-package-versions@v4
with:
package-name: "${{ github.event.repository.name }}/${{ matrix.name }}"
package-type: "container"
min-versions-to-keep: 10
min-versions-to-keep: 20
ignore-versions: "^(prod|test)$"

deploys-prod:
name: PROD Deployments
name: PROD Deploys
needs: [integration-tests, cypress-e2e]
environment: prod
runs-on: ubuntu-22.04
Expand Down
6 changes: 3 additions & 3 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM node:20-bullseye-slim AS build
# Build static files
FROM node:20.6.1-bullseye-slim AS build

# Install packages, build and keep only prod packages
WORKDIR /app
Expand All @@ -7,8 +8,7 @@ COPY ./src ./src
RUN npm ci --omit=dev --ignore-scripts && \
npm run build


# Deployment container
# Deploy container
FROM gcr.io/distroless/nodejs20-debian11:nonroot
ENV NODE_ENV production

Expand Down
4 changes: 1 addition & 3 deletions database/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ FROM postgres:15
# RUN sed -i '/EXISTS postgis_tiger_geocoder;*/a CREATE EXTENSION IF NOT EXISTS pgcrypto;' \
# /docker-entrypoint-initdb.d/10_postgis.sh

# Health check - recommended for local dev
# Health check and non-privileged user
HEALTHCHECK --interval=15s --timeout=5s --retries=3 CMD [ "pg_isready" ]

# Non-privileged user
USER postgres
4 changes: 1 addition & 3 deletions database/postgis/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ FROM postgis/postgis:15-master
# RUN sed -i '/EXISTS postgis_tiger_geocoder;*/a CREATE EXTENSION IF NOT EXISTS pgcrypto;' \
# /docker-entrypoint-initdb.d/10_postgis.sh

# Health check - recommended for local dev
# Health check and non-privileged user
HEALTHCHECK --interval=15s --timeout=5s --retries=3 CMD [ "pg_isready" ]

# Non-privileged user
USER postgres
8 changes: 5 additions & 3 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Build static files
FROM node:alpine3.16 AS build
FROM node:20.6.1-bullseye-slim AS build

# Install packages, build and keep only prod packages
WORKDIR /app
COPY . .
RUN npm ci --ignore-scripts && \
COPY *.json *.ts index.html ./
COPY ./src ./src
RUN npm ci --omit=dev --ignore-scripts && \
npm run build

# Caddy
Expand Down
Loading

0 comments on commit 9c12a8e

Please sign in to comment.