-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #458 from AutomatingSciencePipeline/tilt-dev
Tilt Dev Setup
- Loading branch information
Showing
16 changed files
with
375 additions
and
82 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Setup the needed k8s yamls | ||
k8s_yaml([ | ||
"kubernetes_init/tilt/cluster-role-job-creator.yaml", | ||
"kubernetes_init/tilt/role-binding-job-creator.yaml", | ||
"kubernetes_init/kubernetes_secrets/secret.yaml", | ||
"kubernetes_init/tilt/deployment-frontend.yaml", | ||
"kubernetes_init/tilt/service-frontend.yaml", | ||
"kubernetes_init/tilt/deployment-backend.yaml", | ||
"kubernetes_init/tilt/service-backend-dev.yaml", | ||
"kubernetes_init/tilt/watch-runner-cronjob.yaml", | ||
]) | ||
|
||
# Setup the k8s_resource | ||
k8s_resource("glados-frontend", port_forwards="3000", labels=["frontend"]) | ||
k8s_resource("glados-backend", port_forwards="5050", labels=["backend"]) | ||
k8s_resource("watch-runner-changes", labels=["runner"]) | ||
|
||
# Build the frontend | ||
docker_build("frontend", | ||
context='./apps/frontend', | ||
live_update=[ | ||
sync("./apps/frontend", "/usr/src/app") | ||
], | ||
dockerfile='./apps/frontend/frontend-dev.Dockerfile') | ||
|
||
# Build the backend | ||
docker_build("backend", | ||
context='./apps/backend', | ||
live_update=[ | ||
sync("./apps/backend", "/app"), | ||
run('cd /app && pip install -r requirements.txt', | ||
trigger='./requirements.txt'), | ||
|
||
], | ||
dockerfile='./apps/backend/backend-dev.Dockerfile') | ||
|
||
# Build the runner | ||
docker_build("runner", | ||
context='./apps/runner', | ||
dockerfile='./apps/runner/runner.Dockerfile', | ||
match_in_env_vars=True) | ||
|
||
# Ignore the runner not being used | ||
update_settings(suppress_unused_image_warnings=["runner"]) |
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,29 @@ | ||
# syntax=docker/dockerfile:1 | ||
FROM python:3.8-slim AS base | ||
|
||
# RUN apt-get update && \ | ||
# apt-get install -y ca-certificates curl gnupg && \ | ||
# install -m 0755 -d /etc/apt/keyrings && \ | ||
# curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg && \ | ||
# chmod a+r /etc/apt/keyrings/docker.gpg | ||
|
||
WORKDIR /app | ||
COPY . /app | ||
|
||
FROM base AS python_dependencies | ||
RUN pip install pipenv | ||
COPY Pipfile . | ||
COPY Pipfile.lock . | ||
|
||
# ===================================================================================================== | ||
FROM python_dependencies AS production | ||
# Args explanation: https://stackoverflow.com/a/49705601 | ||
# https://pipenv-fork.readthedocs.io/en/latest/basics.html#pipenv-install | ||
RUN pipenv install --system --deploy --ignore-pipfile | ||
|
||
ADD . . | ||
|
||
USER root | ||
ENV FLASK_DEBUG True | ||
EXPOSE $BACKEND_PORT | ||
CMD flask run --host=0.0.0.0 -p $BACKEND_PORT |
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 |
---|---|---|
|
@@ -2,6 +2,7 @@ apiVersion: batch/v1 | |
kind: Job | ||
metadata: | ||
name: runner | ||
namespace: default | ||
spec: | ||
template: | ||
metadata: | ||
|
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,23 @@ | ||
FROM node:20-alpine AS base | ||
|
||
# Add essential utilities | ||
RUN apk add --no-cache bash libc6-compat | ||
|
||
WORKDIR /usr/src/app | ||
|
||
# Install dependencies | ||
FROM base AS deps | ||
COPY package.json package-lock.json ./ | ||
RUN npm install -g pnpm | ||
RUN pnpm import | ||
RUN pnpm install --frozen-lockfile | ||
|
||
# Install sharp to optimize images | ||
RUN pnpm add sharp | ||
|
||
ADD . . | ||
|
||
# Expose the frontend port | ||
EXPOSE $FRONTEND_WEBSERVER_PORT | ||
|
||
CMD ["npm", "run", "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
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 |
---|---|---|
|
@@ -5,4 +5,4 @@ metadata: | |
rules: | ||
- apiGroups: ["batch"] | ||
resources: ["jobs"] | ||
verbs: ["create"] | ||
verbs: ["create", "delete"] |
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
Oops, something went wrong.