~hokiegeek/biologist-web

e6c182ae94ee7c30be6b763c0178c00f4220db81 — HokieGeek 9 months ago 7530571 2.1.1
Refactored to run as a Cloud Run thingy
4 files changed, 56 insertions(+), 6 deletions(-)

A .build.yml
M .gitlab-ci.yml
M Dockerfile
M package.json
A .build.yml => .build.yml +51 -0
@@ 0,0 1,51 @@
image: alpine/edge
packages:
  - nodejs
  - npm
  - chromium
  - harfbuzz
  - nss
  - docker
  - shadow
sources:
  - https://git.sr.ht/~hokiegeek/biologist-web
environment:
  PROJ: biologist-web
  CI_COMMIT_TAG: $(git --work-tree=./biologist-web --git-dir=./biologist-web/.git describe)
  CI_REGISTRY: quay.io
  CI_REGISTRY_USER: hokiegeek
secrets:
  - d675b280-e56b-4c0f-9908-549c70a7e2f9
tasks:
  - setup: |
      sudo mount -t tmpfs -o size=4G /dev/null /dev/shm
      sudo service cgroups start
      sleep 2
      sudo nohup dockerd --bip 172.18.0.1/16 </dev/null >/dev/null 2>&1 &
      sleep 5
      sudo addgroup $(whoami) docker
  - install: |
      cd ${PROJ}
      npm install
  - lint: |
      cd ${PROJ}
      npm run lint
  - build: |
      cd ${PROJ}
      npm run build
      version=$(awk 'BEGIN { FS=":"; RS="," } $1 ~ /"version"/ { gsub(/( |")/, "", $0); print $2 }' package.json)
      sed -i '/^<head>$/ a\    <meta name="application-name" content="hokiegeek.net_tea" data-version="'${version}${version_suffix:+":${version_suffix}"}'" />' dist/index.html
  - test: |
      export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true"
      export CHROME_BIN="/usr/bin/chromium-browser"
      cd ${PROJ}
      npm run test
  - package: |
      cd ${PROJ}
      IMAGE=${CI_REGISTRY}/hokiegeek/${PROJ}
      IMAGE_TAG=${IMAGE}:${CI_COMMIT_TAG}
      IMAGE_LATEST_TAG=${IMAGE}:latest
      docker build -t $IMAGE_TAG -t $IMAGE_LATEST_TAG .
      cat $HOME/.image_registry_token | docker login --username ${CI_REGISTRY_USER} --password-stdin ${CI_REGISTRY}
      docker push $IMAGE_TAG
      docker push $IMAGE_LATEST_TAG

M .gitlab-ci.yml => .gitlab-ci.yml +1 -1
@@ 20,7 20,7 @@ cache:
  before_script:
    - npm install
  script:
    - npm run ng -- build --base-href .
    - npm run ng -- build
  after_script:
    - version=$(awk 'BEGIN { FS=":"; RS="," } $1 ~ /"version"/ { gsub(/( |")/, "", $0); print $2 }' package.json)
    - sed -i '/^<head>$/ a\    <meta name="application-name" content="hokiegeek.net_life" data-version="'${version}${version_suffix:+":${version_suffix}"}'" />' dist/index.html

M Dockerfile => Dockerfile +2 -3
@@ 1,3 1,2 @@
FROM nginx
RUN sed -i '/location \/ {/{n;n;s/.*/try_files $uri $uri\/ \/index.html;/}' /etc/nginx/conf.d/default.conf
COPY dist/ /usr/share/nginx/html/
FROM quay.io/hokiegeek/biologist
COPY dist/* /web/

M package.json => package.json +2 -2
@@ 1,11 1,11 @@
{
  "name": "biologist-web",
  "version": "2.1.0",
  "version": "2.1.1",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "serve": "ng serve --base-href . --prod --configuration production",
    "build": "ng build --base-href . --prod --build-optimizer --configuration production",
    "build": "ng build --prod --build-optimizer --configuration production",
    "test": "ng test --browsers ChromeHeadlessNoSandbox --watch=false --code-coverage",
    "test-dev": "CHROME_BIN=/usr/bin/google-chrome-stable ng test --browsers Chrome --code-coverage --watch --source-map=false",
    "lint": "ng lint",