Skip to content

Commit

Permalink
feat: bump Node version to 18.18.2 HP-1841
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkojamG committed Feb 15, 2024
1 parent b4e531d commit f512cd6
Show file tree
Hide file tree
Showing 7 changed files with 682 additions and 644 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

- uses: actions/setup-node@v2
with:
node-version: '14.19.1'
node-version: '18.18.2'

- name: Get yarn cache directory path
id: yarn-cache-dir-path
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.18.2
66 changes: 44 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# ===============================================
FROM helsinkitest/node:14-slim as appbase
FROM registry.access.redhat.com/ubi9/nodejs-18 as appbase
# ===============================================

WORKDIR /app

USER root
RUN curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo
RUN yum -y install yarn

# Offical image has npm log verbosity as info. More info - https://github.com/nodejs/docker-node#verbosity
ENV NPM_CONFIG_LOGLEVEL warn

Expand All @@ -10,55 +17,66 @@ ARG NODE_ENV=production
ENV NODE_ENV $NODE_ENV

# Global npm deps in a non-root user directory
ENV NPM_CONFIG_PREFIX=/app/.npm-global
ENV PATH=$PATH:/app/.npm-global/bin
# ENV NPM_CONFIG_PREFIX=/app/.npm-global
# ENV PATH=$PATH:/app/.npm-global/bin

# Yarn
ENV YARN_VERSION 1.22.19
RUN yarn policies set-version $YARN_VERSION

# Use non-root user
USER appuser

# Copy package.json and package-lock.json/yarn.lock files
COPY package*.json *yarn* ./
COPY package*.json *yarn* /app/
RUN chown -R default:root /app

# Install npm depepndencies
ENV PATH /app/node_modules/.bin:$PATH
# ENV PATH /app/node_modules/.bin:$PATH

USER root
RUN bash /tools/apt-install.sh build-essential
# USER root
# RUN bash /tools/apt-install.sh build-essential

USER default

USER appuser
RUN yarn config set network-timeout 300000
RUN yarn && yarn cache clean --force

USER root
RUN bash /tools/apt-cleanup.sh build-essential
COPY .eslintrc.json .eslintignore tsconfig.json .prettierrc.json .env* /app/
COPY ./src /app/src
COPY ./scripts /app/scripts
COPY ./public /app/public
# USER root
# RUN bash /tools/apt-cleanup.sh build-essential

# RUN yarn build

# =============================
FROM appbase as development
# =============================

WORKDIR /app

# Set NODE_ENV to development in the development container
ARG NODE_ENV=development
ENV NODE_ENV $NODE_ENV

# copy in our source code last, as it changes the most
COPY --chown=appuser:appuser . .
# COPY . /app

# Bake package.json start command into the image
CMD ["react-scripts", "start"]
CMD yarn start

# ===================================
FROM appbase as staticbuilder
# ===================================

COPY . /app
WORKDIR /app

# COPY . /app
RUN yarn build

# =============================
FROM registry.access.redhat.com/ubi8/nginx-120 as production
FROM registry.access.redhat.com/ubi9/nginx-122 as production
# =============================

USER root
Expand All @@ -70,15 +88,19 @@ RUN chgrp -R 0 /usr/share/nginx/html && \
COPY --from=staticbuilder /app/build /usr/share/nginx/html

# Copy nginx config
COPY .prod/nginx.conf /etc/nginx/
COPY .prod/nginx.conf /etc/nginx/nginx.conf

WORKDIR /usr/share/nginx/html
# Copy default environment config and setup script
# Copy package.json so env.sh can read it
COPY ./scripts/env.sh /opt/env.sh
COPY .env /opt/.env
COPY package.json /opt/package.json
RUN chmod +x /opt/env.sh
COPY ./scripts/env.sh .
COPY .env .
COPY package.json .

EXPOSE 8080
RUN chmod +x env.sh

CMD ["/bin/bash", "-c", "/opt/env.sh /opt /usr/share/nginx/html && nginx -g \"daemon off;\""]
USER 1001

CMD ["/bin/bash", "-c", "/usr/share/nginx/html/env.sh && nginx -g \"daemon off;\""]

EXPOSE 8080
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ version: '3.7'

services:
app:
platform: linux/amd64
container_name: open-city-profile-ui
build:
context: .
Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"license": "MIT",
"private": true,
"dependencies": {
"@apollo/client": "3.6.5",
"@apollo/client": "3.7.10",
"@datapunt/matomo-tracker-react": "^0.5.1",
"@react-aria/visually-hidden": "^3.2.1",
"@sentry/browser": "^6.19.7",
Expand Down Expand Up @@ -43,7 +43,7 @@
"eslint-plugin-sonarjs": "^0.13.0",
"file-saver": "^2.0.2",
"formik": "^2.0.4",
"graphql": "^15.2.0",
"graphql": "^15.7.2",
"graphql.macro": "^1.4.2",
"hds-core": "2.10.0",
"hds-design-tokens": "2.10.0",
Expand All @@ -66,6 +66,7 @@
"react-router": "^5.1.2",
"react-router-dom": "^5.1.2",
"react-scripts": "5.0.1",
"ts-node": "^8.8.2",
"typescript": "4.5.5",
"uuid": "^8.1.0",
"validator": "^13.7.0",
Expand Down Expand Up @@ -99,13 +100,13 @@
"devDependencies": {
"@sinonjs/fake-timers": "^8.1.0",
"@types/sinonjs__fake-timers": "^8.1.0",
"apollo": "^2.33.9",
"apollo": "^2.34.0",
"cross-env": "^7.0.3",
"helsinki-utils": "City-of-Helsinki/helsinki-utils-js#0.1.0",
"ts-node": "^8.8.2"
"helsinki-utils": "City-of-Helsinki/helsinki-utils-js#0.1.0"
},
"resolutions": {
"graphql": "^15.2.0"
"@apollo/federation": "0.38.1",
"graphql": "^15.7.2"
},
"jest": {
"resetMocks": false
Expand Down
34 changes: 17 additions & 17 deletions src/graphql/generatedTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export interface GdprServiceConnectionsQuery_myProfile_serviceConnections {
export interface GdprServiceConnectionsQuery_myProfile {
readonly __typename: "ProfileNode";
/**
* The ID of the object.
* The ID of the object
*/
readonly id: string;
/**
Expand Down Expand Up @@ -194,7 +194,7 @@ export interface GdprServiceConnectionsQuery {
export interface CreateMyProfile_createMyProfile_profile {
readonly __typename: "ProfileNode";
/**
* The ID of the object.
* The ID of the object
*/
readonly id: string;
}
Expand Down Expand Up @@ -267,7 +267,7 @@ export interface DownloadMyProfileQueryVariables {
export interface MyProfileQuery_myProfile_primaryAddress {
readonly __typename: "AddressNode";
/**
* The ID of the object.
* The ID of the object
*/
readonly id: string;
readonly primary: boolean;
Expand All @@ -282,7 +282,7 @@ export interface MyProfileQuery_myProfile_addresses_edges_node {
readonly __typename: "AddressNode";
readonly primary: boolean;
/**
* The ID of the object.
* The ID of the object
*/
readonly id: string;
readonly address: string;
Expand Down Expand Up @@ -311,7 +311,7 @@ export interface MyProfileQuery_myProfile_addresses {
export interface MyProfileQuery_myProfile_primaryEmail {
readonly __typename: "EmailNode";
/**
* The ID of the object.
* The ID of the object
*/
readonly id: string;
readonly email: string;
Expand All @@ -323,7 +323,7 @@ export interface MyProfileQuery_myProfile_emails_edges_node {
readonly __typename: "EmailNode";
readonly primary: boolean;
/**
* The ID of the object.
* The ID of the object
*/
readonly id: string;
readonly email: string;
Expand All @@ -349,7 +349,7 @@ export interface MyProfileQuery_myProfile_emails {
export interface MyProfileQuery_myProfile_primaryPhone {
readonly __typename: "PhoneNode";
/**
* The ID of the object.
* The ID of the object
*/
readonly id: string;
readonly phone: string;
Expand All @@ -361,7 +361,7 @@ export interface MyProfileQuery_myProfile_phones_edges_node {
readonly __typename: "PhoneNode";
readonly primary: boolean;
/**
* The ID of the object.
* The ID of the object
*/
readonly id: string;
readonly phone: string;
Expand Down Expand Up @@ -452,7 +452,7 @@ export interface MyProfileQuery_myProfile_verifiedPersonalInformation {
export interface MyProfileQuery_myProfile {
readonly __typename: "ProfileNode";
/**
* The ID of the object.
* The ID of the object
*/
readonly id: string;
readonly firstName: string;
Expand Down Expand Up @@ -599,7 +599,7 @@ export interface ServiceConnectionsQuery_myProfile_serviceConnections {
export interface ServiceConnectionsQuery_myProfile {
readonly __typename: "ProfileNode";
/**
* The ID of the object.
* The ID of the object
*/
readonly id: string;
/**
Expand Down Expand Up @@ -637,7 +637,7 @@ export interface ServiceConnectionsQueryVariables {
export interface UpdateMyProfile_updateMyProfile_profile_primaryAddress {
readonly __typename: "AddressNode";
/**
* The ID of the object.
* The ID of the object
*/
readonly id: string;
readonly primary: boolean;
Expand All @@ -652,7 +652,7 @@ export interface UpdateMyProfile_updateMyProfile_profile_addresses_edges_node {
readonly __typename: "AddressNode";
readonly primary: boolean;
/**
* The ID of the object.
* The ID of the object
*/
readonly id: string;
readonly address: string;
Expand Down Expand Up @@ -681,7 +681,7 @@ export interface UpdateMyProfile_updateMyProfile_profile_addresses {
export interface UpdateMyProfile_updateMyProfile_profile_primaryEmail {
readonly __typename: "EmailNode";
/**
* The ID of the object.
* The ID of the object
*/
readonly id: string;
readonly email: string;
Expand All @@ -693,7 +693,7 @@ export interface UpdateMyProfile_updateMyProfile_profile_emails_edges_node {
readonly __typename: "EmailNode";
readonly primary: boolean;
/**
* The ID of the object.
* The ID of the object
*/
readonly id: string;
readonly email: string;
Expand All @@ -719,7 +719,7 @@ export interface UpdateMyProfile_updateMyProfile_profile_emails {
export interface UpdateMyProfile_updateMyProfile_profile_primaryPhone {
readonly __typename: "PhoneNode";
/**
* The ID of the object.
* The ID of the object
*/
readonly id: string;
readonly phone: string;
Expand All @@ -731,7 +731,7 @@ export interface UpdateMyProfile_updateMyProfile_profile_phones_edges_node {
readonly __typename: "PhoneNode";
readonly primary: boolean;
/**
* The ID of the object.
* The ID of the object
*/
readonly id: string;
readonly phone: string;
Expand All @@ -757,7 +757,7 @@ export interface UpdateMyProfile_updateMyProfile_profile_phones {
export interface UpdateMyProfile_updateMyProfile_profile {
readonly __typename: "ProfileNode";
/**
* The ID of the object.
* The ID of the object
*/
readonly id: string;
readonly firstName: string;
Expand Down
Loading

0 comments on commit f512cd6

Please sign in to comment.