Skip to content

Commit 4c23f30

Browse files
ocshawncmlsnsnyk-botShawn O'Connorcraigrbarnes
authored
Update fork to align with upstream (#20)
* fix: package.json & package-lock.json to reduce vulnerabilities (#82) The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-NEXT-9508709 Co-authored-by: snyk-bot <snyk-bot@snyk.io> * update next dependencies to 15.2.4 * Update README.md (#84) * update to @gen3/ff 0.10.85 (#85) * Update README.md (#86) add unrelated-histories information * Fix docker start (#88) * fix Docker not starting * fix Docker not starting * update env files (#89) * Release 0.10.89 (#91) * update to 0.10.89 * update to 0.10.89 * remove old config files/images * update ContentDatabase * update ContentDatabase paths (#93) * update dockerfile --------- Co-authored-by: cmlsn <100160785+cmlsn@users.noreply.github.com> Co-authored-by: snyk-bot <snyk-bot@snyk.io> Co-authored-by: Shawn O'Connor <shawnoconnor@uchicago.edu> Co-authored-by: Craig Barnes <craig.barnes@intelligentlight.com>
1 parent 5001c4d commit 4c23f30

File tree

12 files changed

+1378
-751
lines changed

12 files changed

+1378
-751
lines changed

.env.development

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
GEN3_COMMONS_NAME=gen3
1+
NEXT_PUBLIC_GEN3_COMMONS_NAME=gen3
22
NEXT_PUBLIC_GEN3_API=https://qa-vpodc.planx-pla.net

.env.production

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
GEN3_COMMONS_NAME=gen3
1+
NEXT_PUBLIC_GEN3_COMMONS_NAME=gen3

Dockerfile

Lines changed: 28 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,37 @@
1-
# docker build -t gen3ff .
2-
# docker run -p 3000:3000 -it gen3ff
3-
# for Macbook silicon M1/m2 uncomment the following lines and comment quay.io/cdis/ubuntu:20.04:
4-
#FROM arm64v8/ubuntu:20.04 as build
5-
6-
FROM quay.io/cdis/ubuntu:20.04 AS build
7-
8-
ARG NODE_VERSION=20
9-
10-
ARG BASE_PATH
11-
ARG NEXT_PUBLIC_PORTAL_BASENAME
12-
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
13-
ENV PATH=$PATH:/home/node/.npm-global/bin
1+
# docker build -t ff .
2+
# docker run -p 3000:3000 -it ff
3+
# Build stage
4+
FROM node:20-slim AS builder
145

156
WORKDIR /gen3
167

17-
RUN apt-get update && apt-get install -y --no-install-recommends \
18-
build-essential \
19-
libssl1.1 \
20-
libgnutls30 \
21-
ca-certificates \
22-
curl \
23-
git \
24-
gnupg \
25-
&& mkdir -p /etc/apt/keyrings \
26-
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
27-
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_VERSION.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
28-
&& apt-get update \
29-
&& apt-get install -y nodejs \
30-
&& apt-get clean \
31-
&& npm install -g npm@10.5.2
32-
33-
RUN addgroup --system --gid 1001 nextjs && adduser --system --uid 1001 nextjs
34-
COPY ./package.json ./package-lock.json ./
35-
COPY ./package-lock.json ./
8+
COPY ./package.json ./package-lock.json ./next.config.js ./tsconfig.json ./.env.development ./tailwind.config.js ./postcss.config.js ./start.sh ./.env.production ./
9+
RUN npm ci
3610
COPY ./src ./src
3711
COPY ./public ./public
3812
COPY ./config ./config
39-
COPY ./next.config.js ./
40-
COPY ./tsconfig.json ./
41-
COPY ./.env.development ./
42-
COPY ./.env.production ./
43-
COPY ./tailwind.config.js ./
44-
COPY ./postcss.config.js ./
4513
COPY ./start.sh ./
46-
RUN npm ci
47-
RUN npm install \
48-
"@swc/core" \
49-
"@napi-rs/magic-string"
50-
RUN npm run build
14+
RUN npm install @swc/core @napi-rs/magic-string && \
15+
npm run build
16+
17+
# Production stage
18+
FROM node:20-slim AS runner
19+
20+
WORKDIR /gen3
21+
22+
RUN addgroup --system --gid 1001 nextjs && \
23+
adduser --system --uid 1001 nextjs
24+
25+
COPY --from=builder /gen3/package.json ./
26+
COPY --from=builder /gen3/node_modules ./node_modules
27+
COPY --from=builder /gen3/config ./config
28+
COPY --from=builder /gen3/.next ./.next
29+
COPY --from=builder /gen3/public ./public
30+
COPY --from=builder /gen3/start.sh ./start.sh
31+
RUN mkdir -p /gen3/.next/cache/images
32+
RUN chmod -R 777 /gen3/.next/cache
33+
RUN chown nextjs:nextjs /gen3/.next
34+
35+
USER nextjs:nextjs
5136
ENV PORT=3000
5237
CMD bash ./start.sh

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ docker build .
6565
```
6666
## Updating a forked commons
6767

68-
To update a forked commons, the following steps usually apply.
68+
The following steps usually apply to update a forked commons.
6969

7070
Get the changes from the parent fork:
7171
```bash
@@ -76,6 +76,14 @@ Create a branch and merge changes from upstream:
7676
```bash
7777
git merge upstream/main
7878
```
79-
You will see merge conflicts. In general: **take the remote's version for everything except the config files**, as those are customized to the commons config. Resolve the remaining config issues and open a PR.
79+
If the above has the error message: "fatal: refusing to merge unrelated histories" error.
80+
This often happens when the repo was created as a template, not a fork.
81+
To resolve this, the ```--allow-unrelated-histories``` flag can be used during the merge operation. This flag forces Git to merge the branches despite lacking a common history.
82+
```bash
83+
git merge upstream/main --allow-unrelated-histories
84+
```
85+
If you use this flag, it is recommended that you carefully review the changes and resolve any conflicts before finalizing the merge.
86+
87+
You will see merge conflicts. In general: **take the remote's version for everything except the config files**, as those are customized to the commons config. Resolve any remaining config issues and open a PR.
8088
Test the new common by running it locally or in a staging environment.
8189

next.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ const withMDX = require('@next/mdx')({
1919

2020
// Next configuration with support for rewrting API to existing common services
2121
const nextConfig = {
22-
output: 'standalone',
2322
reactStrictMode: true,
2423
pageExtensions: ['mdx', 'md', 'jsx', 'js', 'tsx', 'ts'],
2524
basePath: process.env.BASE_PATH || '',

0 commit comments

Comments
 (0)