Skip to content

Commit

Permalink
Merge pull request #82 from Teknologforeningen/update-deps
Browse files Browse the repository at this point in the history
Update dependencies and docker image
  • Loading branch information
backjonas authored Nov 22, 2024
2 parents 9ec2a4f + 08a6ac5 commit 7fe2321
Show file tree
Hide file tree
Showing 10 changed files with 712 additions and 672 deletions.
4 changes: 1 addition & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"plugins": [
"@typescript-eslint"
],
"plugins": ["@typescript-eslint"],
"extends": [
"next/core-web-vitals",
"plugin:@typescript-eslint/recommended",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ jobs:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
labels: ${{ steps.meta.outputs.labels }}
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Install dependencies only when needed
FROM node:20.13-alpine3.18 AS deps
FROM node:22.11-alpine3.19 AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile

# Rebuild the source code only when needed
FROM node:20.13-alpine3.18 AS builder
FROM node:22.11-alpine3.19 AS builder
WORKDIR /app
COPY . .
COPY --from=deps /app/node_modules ./node_modules
RUN yarn build

# Production image, copy all the files and run next
FROM node:20.13-alpine3.18 AS runner
FROM node:22.11-alpine3.19 AS runner
WORKDIR /app

ENV NODE_ENV production
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ Teknologföreningen's homepage. Built with Next.js and Strapi.
4. Set environmental variables in `.env.local`
5. Run development server `yarn dev`


## Google environment variables

For calendar and file handling we use the google api. These requests are fetched with 2 [google service accounts](https://cloud.google.com/iam/docs/service-account-overview), one private defined by GOOGLE_PRIVATE_CREDS (for private file handling) and one public GOOGLE_CREDS (public file handling and calendar). These are currently managed by Teknologföreningen google workspace admin. New service account can be created like [this](https://cloud.google.com/iam/docs/service-accounts-create), the service account environment variables are [google service account keys](https://cloud.google.com/iam/docs/keys-create-delete#creating). Google drive and calendar api read permissions need to be given to the service accounts for the features to work properly.

### Calendar

The calendar events are directly fetched from a public google calendar by [Google calendar api](https://developers.google.com/calendar/api/quickstart/nodejs) (calendar defined by NEXT_PUBLIC_GOOGLE_CALENDAR_ID in .env file). Implementation in [/lib/google/calendar.ts](https://github.com/Teknologforeningen/tf.fi/blob/master/lib/google/calendar.ts).

### File handling
The file handling is separated into public and private (needing auth) files, implementaiton in [app/api/drive](https://github.com/Teknologforeningen/tf.fi/tree/master/app/api/drive). These use the [google drive api](https://developers.google.com/drive/api/guides/about-sdk). The files are fetched from a specific google workspace for which SHARED_GOOGLE_DRIVE_ID needs to be defined to search files from the workspace.

The file handling is separated into public and private (needing auth) files, implementaiton in [app/api/drive](https://github.com/Teknologforeningen/tf.fi/tree/master/app/api/drive). These use the [google drive api](https://developers.google.com/drive/api/guides/about-sdk). The files are fetched from a specific google workspace for which SHARED_GOOGLE_DRIVE_ID needs to be defined to search files from the workspace.
2 changes: 1 addition & 1 deletion components/header/navbar/searchpage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const SearchOverlay = ({
const resDrive = await searchDrive(
queryInput,
//only nextPage if append is true
append ? fileResults.nextPageToken ?? undefined : undefined
append ? (fileResults.nextPageToken ?? undefined) : undefined
)
//if append then add to existing files else reset
if (append) {
Expand Down
2 changes: 1 addition & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
2 changes: 1 addition & 1 deletion styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}
}
4 changes: 3 additions & 1 deletion styles/links.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@

.link-text::before {
transform-origin: 50% 100%;
transition: clip-path 0.3s, transform 0.3s cubic-bezier(0.2, 1, 0.8, 1);
transition:
clip-path 0.3s,
transform 0.3s cubic-bezier(0.2, 1, 0.8, 1);
clip-path: polygon(
0% 0%,
0% 100%,
Expand Down
41 changes: 9 additions & 32 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,44 +13,21 @@
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"lib": ["dom", "dom.iterable", "esnext"],
"paths": {
"@components/*": [
"./components/*"
],
"@lib/*": [
"./lib/*"
],
"@models/*": [
"./models/*"
],
"@styles/*": [
"./styles/*"
],
"@utils/*": [
"./utils/*"
],
"@middleware/*": [
"./middleware/*"
]
"@components/*": ["./components/*"],
"@lib/*": ["./lib/*"],
"@models/*": ["./models/*"],
"@styles/*": ["./styles/*"],
"@utils/*": ["./utils/*"],
"@middleware/*": ["./middleware/*"]
},
"plugins": [
{
"name": "next"
}
]
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts"
],
"exclude": [
"node_modules"
]
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
Loading

0 comments on commit 7fe2321

Please sign in to comment.