Skip to content

Commit

Permalink
Init TF Scanner (#34)
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Brooks <[email protected]>
  • Loading branch information
zacharyblasczyk authored Sep 18, 2024
1 parent 41b7b24 commit 2569afe
Show file tree
Hide file tree
Showing 33 changed files with 2,654 additions and 1,227 deletions.
4 changes: 1 addition & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
# The database URL is used to connect to your Supabase database.
POSTGRES_URL="postgres://postgres.[USERNAME]:[PASSWORD]@aws-0-eu-central-1.pooler.supabase.com:6543/postgres?workaround=supabase-pooler.vercel"


# You can generate the secret via 'openssl rand -base64 32' on Unix
# @see https://next-auth.js.org/configuration/options#secret
AUTH_SECRET='supersecret'


JOB_AGENT_WORKSPACE="ctrlplane"
JOB_AGENT_NAME="agent"
JOB_AGENT_API_KEY=
JOB_AGENT_API_KEY=
12 changes: 12 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ jobs:
- name: Lint
run: pnpm lint && pnpm lint:ws

test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup
uses: ./tooling/github/setup

- name: Run Tests
run: turbo test

format:
name: Format
runs-on: ubuntu-latest
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/providers-terraform-cloud-scanner.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Providers / Terraform Cloud Scanner

on:
pull_request:
branches: ["*"]
paths:
- providers/terraform-cloud-scanner/**
- .github/workflows/providers-terraform-cloud-scanner.yaml
- pnpm-lock.yaml
push:
branches: ["main"]
paths:
- providers/terraform-cloud-scanner/**
- .github/workflows/providers-terraform-cloud-scanner.yaml
- pnpm-lock.yaml

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ctrlplane/terraform-cloud-scanner
tags: |
type=sha,format=short,prefix=
- name: Build
uses: docker/build-push-action@v6
if: github.ref != 'refs/heads/main'
with:
push: false
file: providers/terraform-cloud-scanner/Dockerfile
tags: ${{ steps.meta.outputs.tags }}

- name: Build and Push
uses: docker/build-push-action@v6
if: github.ref == 'refs/heads/main'
with:
push: true
file: providers/terraform-cloud-scanner/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
7 changes: 6 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,10 @@
"mode": "auto"
}
],
"cSpell.words": ["deployables"]
"cSpell.words": ["deployables"],
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"prettier.printWidth": 80
}
}
5 changes: 1 addition & 4 deletions apps/docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
ARG NODE_VERSION=22
FROM node:${NODE_VERSION}-alpine AS base


FROM base AS builder
RUN apk add --no-cache libc6-compat
RUN apk update

RUN npm install -g turbo


FROM base AS installer

RUN apk add --no-cache libc6-compat
Expand Down Expand Up @@ -47,7 +45,6 @@ COPY . .

RUN turbo build --filter=...@ctrlplane/docs


FROM base AS runner
WORKDIR /app

Expand All @@ -63,4 +60,4 @@ EXPOSE 3000
ENV PORT=3000
ENV NODE_ENV=production

CMD HOSTNAME="0.0.0.0" node apps/docs/server.js
CMD ["HOSTNAME=0.0.0.0", "node", "apps/docs/server.js"]
2 changes: 1 addition & 1 deletion apps/event-worker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ USER nodejs

ENV NODE_ENV=production

CMD node apps/event-worker/dist/index.js
CMD ["node", "apps/event-worker/dist/index.js"]
2 changes: 1 addition & 1 deletion apps/job-policy-checker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ USER nodejs

ENV NODE_ENV=production

CMD node apps/job-policy-checker/dist/index.js
CMD ["node", "apps/job-policy-checker/dist/index.js"]
5 changes: 1 addition & 4 deletions apps/webservice/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
ARG NODE_VERSION=20
FROM node:${NODE_VERSION}-alpine AS base


FROM base AS builder

RUN apk add --no-cache libc6-compat python3 make g++
Expand All @@ -12,7 +11,6 @@ ENV PATH="$PNPM_HOME:$PATH"
RUN npm install -g turbo
RUN corepack enable pnpm


FROM builder AS installer

WORKDIR /app
Expand Down Expand Up @@ -44,7 +42,6 @@ COPY . .

RUN turbo build --filter=...@ctrlplane/webservice


FROM base AS runner
WORKDIR /app

Expand All @@ -62,4 +59,4 @@ ENV PORT=3000
ENV AUTH_TRUST_HOST=true

Check warning on line 59 in apps/webservice/Dockerfile

View workflow job for this annotation

GitHub Actions / build

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "AUTH_TRUST_HOST") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/
ENV NODE_ENV=production

CMD HOSTNAME="0.0.0.0" node apps/webservice/server.js
CMD ["HOSTNAME=0.0.0.0", "node", "apps/webservice/server.js"]
2 changes: 1 addition & 1 deletion apps/webshell-router/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ RUN adduser --system --uid 1001 expressjs
USER expressjs

COPY --from=installer /app .
CMD node apps/webshell-router/dist/index.js
CMD ["node", "apps/webshell-router/dist/index.js"]
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"scripts": {
"build": "turbo build",
"build:digitalocean": "pnpm install --production=false && pnpm build",
"test": "turbo test",
"clean": "git clean -xdf node_modules",
"clean:workspaces": "turbo clean && find . -type d -name 'dist' -exec rm -rf {} +",
"db:push": "pnpm -F db push",
Expand Down
2 changes: 1 addition & 1 deletion packages/db/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ COPY ./packages/db/drizzle ./packages/db/dist/drizzle

ENV NODE_ENV=production

CMD node packages/db/dist/migrate.js
CMD ["node", "packages/db/dist/migrate.js"]
Loading

0 comments on commit 2569afe

Please sign in to comment.