Skip to content

Commit

Permalink
Merge branch 'main' into pablogracia/anhadir-tipos-de-ayuda
Browse files Browse the repository at this point in the history
  • Loading branch information
PabloGracia committed Nov 6, 2024
2 parents 835b9fc + 0e2ce95 commit 73468a2
Show file tree
Hide file tree
Showing 25 changed files with 1,279 additions and 2,381 deletions.
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
GITHUB_TOKEN=
NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_ANON_KEY=
8 changes: 4 additions & 4 deletions .github/dana-crawler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: Docker

on:
push:
branches: ["main"]
branches: ['main']
# Publish semver tags as releases.
tags: ["v*.*.*"]
tags: ['v*.*.*']
paths:
- "tools/DanaCrawler/**"
- 'tools/DanaCrawler/**'

env:
REGISTRY: ghcr.io
Expand All @@ -27,7 +27,7 @@ jobs:
- name: Install cosign
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
with:
cosign-release: "v2.2.4"
cosign-release: 'v2.2.4'

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/code-quality-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Code quality checks

on:
push:
branches:
- '**'

jobs:
quality:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Install dependencies
run: npm ci

- name: Run ESLint
run: npm run lint

- name: Check formatting
run: npm run prettier:check

- name: Build app
env:
NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }}
run: npm run build
8 changes: 4 additions & 4 deletions .github/workflows/dana-crawler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: Docker

on:
push:
branches: ["main"]
branches: ['main']
# Publish semver tags as releases.
tags: ["v*.*.*"]
tags: ['v*.*.*']
paths:
- "tools/DanaCrawler/**"
- 'tools/DanaCrawler/**'

env:
REGISTRY: ghcr.io
Expand All @@ -27,7 +27,7 @@ jobs:
- name: Install cosign
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
with:
cosign-release: "v2.2.4"
cosign-release: 'v2.2.4'

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
Expand Down
42 changes: 29 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,46 @@
FROM node:18-alpine
ARG CACHE_BURST=1
# Build stage
FROM node:18-alpine AS builder

WORKDIR /app

ARG NEXT_PUBLIC_SUPABASE_URL
ARG NEXT_PUBLIC_SUPABASE_ANON_KEY

ENV NODE_ENV="development" \
NEXT_TELEMETRY_DISABLED=1 \
# Build-time environment variables
ENV NEXT_TELEMETRY_DISABLED=1 \
NEXT_PUBLIC_SUPABASE_URL=$NEXT_PUBLIC_SUPABASE_URL \
NEXT_PUBLIC_SUPABASE_ANON_KEY=$NEXT_PUBLIC_SUPABASE_ANON_KEY

WORKDIR /app
COPY package.json package-lock.json ./

COPY package*.json ./

# Install ALL dependencies
RUN npm install
RUN npm ci

COPY . .

RUN rm -rf .next

RUN npm run build

# Switch to production after build
ENV NODE_ENV="production"
# Production stage
FROM node:18-alpine AS runner

WORKDIR /app

# Run-time environment variables
ENV NODE_ENV=production \
NEXT_TELEMETRY_DISABLED=1 \
NEXT_PUBLIC_SUPABASE_URL=$NEXT_PUBLIC_SUPABASE_URL \
NEXT_PUBLIC_SUPABASE_ANON_KEY=$NEXT_PUBLIC_SUPABASE_ANON_KEY

COPY --from=builder /app/next.config.mjs ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json

# Clean up development dependencies
RUN npm prune --production
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
USER nextjs

EXPOSE 3000

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ Encontraras un archivo .env.example para usar de referencia

Las contribuciones son siempre bienvenidas.

Consulta `contributing.md` para saber cómo empezar.
Consulta `contributing.md` para saber cómo empezar.
56 changes: 28 additions & 28 deletions kubernetes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
serviceAccountName: datadog-agent
containers:
- name: emergency-cv--webapp
image: "localhost:30500/emergency-cv/webapp:VAR_GITHUB_COMMIT_HASH"
image: 'localhost:30500/emergency-cv/webapp:VAR_GITHUB_COMMIT_HASH'
ports:
- containerPort: 3000
env:
Expand All @@ -42,37 +42,37 @@ spec:
image: gcr.io/datadoghq/agent:latest
env:
- name: DD_API_KEY
value: "VAR_DATADOG_API_KEY"
value: 'VAR_DATADOG_API_KEY'
- name: DD_SITE
value: "datadoghq.eu"
value: 'datadoghq.eu'
- name: DD_LOGS_ENABLED
value: "true"
value: 'true'
- name: DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL
value: "true"
value: 'true'
- name: DD_APM_ENABLED
value: "true"
value: 'true'
- name: DD_APM_NON_LOCAL_TRAFFIC
value: "true"
value: 'true'
- name: DD_KUBELET_TLS_VERIFY
value: "false"
value: 'false'
- name: DD_PROCESS_AGENT_ENABLED
value: "true"
value: 'true'
- name: DD_CONTAINER_EXCLUDE
value: "image:gcr.io/datadoghq/agent"
value: 'image:gcr.io/datadoghq/agent'
- name: DD_CONTAINER_INCLUDE_METRICS
value: "name:emergency-cv--webapp"
value: 'name:emergency-cv--webapp'
- name: DD_CONTAINER_INCLUDE_LOGS
value: "name:emergency-cv--webapp"
value: 'name:emergency-cv--webapp'
- name: DD_SYSTEM_PROBE_ENABLED
value: "false"
value: 'false'
- name: DD_KUBERNETES_KUBELET_HOST
valueFrom:
fieldRef:
fieldPath: status.hostIP
securityContext:
privileged: false
capabilities:
add: [ "SYS_ADMIN" ]
add: ['SYS_ADMIN']
ports:
- containerPort: 8126
name: traceport
Expand Down Expand Up @@ -117,13 +117,13 @@ spec:
- name: kaniko
image: gcr.io/kaniko-project/executor:latest
args:
- "--context=git://[email protected]/pedrolivaresanchez/emergency-cv.git"
- "--dockerfile=Dockerfile"
- "--destination=idl-apps--container-registry-service:5000/emergency-cv/webapp:VAR_GITHUB_COMMIT_HASH"
- "--insecure"
- "--skip-tls-verify"
- "--build-arg=NEXT_PUBLIC_SUPABASE_URL=VAR_SUPABASE_URL"
- "--build-arg=NEXT_PUBLIC_SUPABASE_ANON_KEY=VAR_SUPABASE_ANON_KEY"
- '--context=git://[email protected]/pedrolivaresanchez/emergency-cv.git'
- '--dockerfile=Dockerfile'
- '--destination=idl-apps--container-registry-service:5000/emergency-cv/webapp:VAR_GITHUB_COMMIT_HASH'
- '--insecure'
- '--skip-tls-verify'
- '--build-arg=NEXT_PUBLIC_SUPABASE_URL=VAR_SUPABASE_URL'
- '--build-arg=NEXT_PUBLIC_SUPABASE_ANON_KEY=VAR_SUPABASE_ANON_KEY'
restartPolicy: Never
backoffLimit: 2
---
Expand All @@ -138,7 +138,7 @@ kind: ClusterRole
metadata:
name: datadog-agent
rules:
- apiGroups: [ "" ]
- apiGroups: ['']
resources:
- nodes
- nodes/metrics
Expand All @@ -149,16 +149,16 @@ rules:
- services
- endpoints
- events
verbs: [ "get", "list", "watch" ]
- apiGroups: [ "" ]
verbs: ['get', 'list', 'watch']
- apiGroups: ['']
resources:
- configmaps
resourceNames: [ "datadog-leader-election" ]
verbs: [ "get", "update" ]
- apiGroups: [ "" ]
resourceNames: ['datadog-leader-election']
verbs: ['get', 'update']
- apiGroups: ['']
resources:
- configmaps
verbs: [ "create" ]
verbs: ['create']
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand Down
8 changes: 4 additions & 4 deletions middleware.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { type NextRequest } from 'next/server'
import { updateSession } from 'src/lib/supabase/middleware'
import { type NextRequest } from 'next/server';
import { updateSession } from 'src/lib/supabase/middleware';

export async function middleware(request: NextRequest) {
return await updateSession(request)
return await updateSession(request);
}

export const config = {
Expand All @@ -16,4 +16,4 @@ export const config = {
*/
'/((?!_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)',
],
}
};
1 change: 1 addition & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/** @type {import('next').NextConfig} */

const nextConfig = {
reactStrictMode: true,
experimental: {
Expand Down
Loading

0 comments on commit 73468a2

Please sign in to comment.