Skip to content

Commit

Permalink
fix dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
berekuk committed Nov 1, 2024
1 parent f16cd18 commit 41d173e
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ops/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Use the official Node.js 20 image for builds
ARG DOCKER_NODE_VERSION=20-bookworm-slim

FROM node:$DOCKER_NODE_VERSION as build
FROM node:$DOCKER_NODE_VERSION AS build

WORKDIR /build
WORKDIR /app

# Install pnpm globally
RUN npm install -g pnpm
Expand All @@ -13,7 +13,6 @@ COPY . .
# Install dependencies
RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store/v3 pnpm install --frozen-lockfile

WORKDIR /app
ENV NODE_ENV=production

RUN pnpm build
3 changes: 3 additions & 0 deletions ops/chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
apiVersion: v2
name: metaforecast
version: "0.1.0"
27 changes: 27 additions & 0 deletions ops/chart/templates/jobs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{- range $jobname, $job := .Values.jobs }}
---
apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ $.Release.Name }}-{{ $jobname }}
spec:
concurrencyPolicy: Forbid
schedule: {{ $job.schedule | required "schedule is required" }}
timeZone: Etc/UTC
jobTemplate:
spec:
template:
spec:
restartPolicy: Never
imagePullSecrets:
- name: {{ required "image.pullSecret is required" $.Values.image.pullSecret }}
containers:
- name: cronjob
image: "{{ required "image.name is required" $.Values.image.name }}:{{ required "image.tag is required" $.Values.image.tag }}"
imagePullPolicy: Always
envFrom:
- secretRef:
name: {{ $.Values.envSecret }}
command:
{{- $job.command | required "command is required" | toYaml | nindent 12 }}
{{- end }}
18 changes: 18 additions & 0 deletions ops/chart/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# To deploy Metaforecast as a Kubernetes chart, you need to provide a valid image.
# QURI doesn't have a public container registry, so you'll have to build the image yourself (from the `ops/Dockerfile` in this repo).
# At QURI, we use a private container registry, and do builds with Argo Workflows.
image:
pullSecret: '' # name of kubernetes secret that provides access to the private container registry
name: '' # full name of the image - override this
tag: '' # tag of the image - override this

# Secret; you should create this in your k8s cluster.
envSecret: metaforecast-env

jobs:
scheduler:
command: ['ts-node', '-T', 'src/backend/flow/doEverythingForScheduler.ts']
schedule: '0 3 * * *' # every day at 3am
frontpage:
command: ['ts-node', '-T', 'src/backend/index.ts', 'frontpage']
schedule: '0 6 * * *' # every day at 6am

0 comments on commit 41d173e

Please sign in to comment.