Skip to content

Commit

Permalink
feat(client): bump versions + refactor docker to reduce filesize
Browse files Browse the repository at this point in the history
  • Loading branch information
kostaspt committed Jan 9, 2022
1 parent 1d0f8b2 commit 18ca71d
Show file tree
Hide file tree
Showing 11 changed files with 3,236 additions and 2,059 deletions.
3 changes: 3 additions & 0 deletions client/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
44 changes: 30 additions & 14 deletions client/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,40 @@
### Build
FROM node:16.2.0-alpine as builder
### Deps
FROM node:16-alpine AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile --network-timeout 1000000

### Builder
FROM node:16-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN yarn build

### Runner
FROM node:16-alpine AS runner
WORKDIR /app

LABEL org.opencontainers.image.source="https://github.com/kostaspt/domane"

WORKDIR /usr/src/app
ENV NODE_ENV production

ARG DOMAIN
RUN test -n "$DOMAIN"
RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001

# Install dependencies
COPY package.json yarn.lock ./
RUN (yarn check --integrity && yarn check --verify-tree) || yarn install --frozen-lockfile --network-timeout 1000000
COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/package.json ./package.json
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

# Generate production build
COPY . .
RUN yarn build
USER nextjs

# Remove dev dependencies
RUN yarn install --production
ARG DOMAIN
RUN test -n "$DOMAIN"

EXPOSE $CLIENT_PORT
ENV PORT $CLIENT_PORT

CMD ["sh" , "-c", "yarn start -p ${CLIENT_PORT}"]
CMD ["node", "server.js"]
4 changes: 3 additions & 1 deletion client/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
3 changes: 3 additions & 0 deletions client/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ module.exports = (phase) => {
const apiUrl = apiDomain.match(/\.local(host)?$/) ? `http://${apiDomain}` : `https://${apiDomain}`;

return {
experimental: {
outputStandalone: true,
},
publicRuntimeConfig: {
API_URL: isProd ? `${apiUrl}/api` : 'http://localhost:4001',
},
Expand Down
56 changes: 29 additions & 27 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,45 @@
"test:coverage": "jest --collect-coverage"
},
"dependencies": {
"@chakra-ui/icons": "^1.0.13",
"@chakra-ui/react": "^1.6.4",
"@chakra-ui/system": "^1.7.0",
"@chakra-ui/theme-tools": "^1.1.7",
"@emotion/react": "^11.4.0",
"@emotion/styled": "^11.3.0",
"@reduxjs/toolkit": "^1.6.0",
"axios": "^0.21.1",
"@chakra-ui/icons": "^1.1.1",
"@chakra-ui/react": "^1.7.4",
"@chakra-ui/system": "^1.9.0",
"@chakra-ui/theme-tools": "^1.3.1",
"@emotion/react": "^11.7.1",
"@emotion/styled": "^11.6.0",
"@reduxjs/toolkit": "^1.7.1",
"axios": "^0.24.0",
"detect-node": "^2.1.0",
"framer-motion": "^4.1.17",
"next": "^11.1.0",
"framer-motion": "^5.5.6",
"next": "^12.0.7",
"react": "^17.0.2",
"react-dom": "17.0.2",
"react-is": "^17.0.2",
"react-redux": "^7.2.4",
"react-redux": "^7.2.6",
"reconnecting-websocket": "^4.4.0",
"redux": "^4.1.0",
"redux": "^4.1.2",
"redux-camel": "^1.1.0",
"redux-logger": "^3.0.6",
"redux-saga": "^1.1.3"
},
"devDependencies": {
"@babel/core": "^7.14.6",
"@svgr/webpack": "^5.5.0",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.0.0",
"@babel/core": "^7.16.7",
"@svgr/webpack": "^6.1.2",
"@testing-library/jest-dom": "^5.16.1",
"@testing-library/react": "^12.1.2",
"@types/detect-node": "^2.0.0",
"@types/jest": "^26.0.23",
"@types/node": "^15.12.5",
"@types/react": "^17.0.11",
"@types/react-redux": "^7.1.16",
"@types/redux-logger": "^3.0.8",
"jest": "^27.0.6",
"jest-config": "^27.0.6",
"prettier": "^2.3.2",
"pretty-quick": "^3.1.1",
"ts-jest": "^27.0.3",
"typescript": "^4.3.4"
"@types/jest": "^27.4.0",
"@types/node": "^17.0.8",
"@types/react": "^17.0.38",
"@types/react-redux": "^7.1.21",
"@types/redux-logger": "^3.0.9",
"eslint": "8.6.0",
"eslint-config-next": "12.0.7",
"jest": "^27.4.7",
"jest-config": "^27.4.7",
"prettier": "^2.5.1",
"pretty-quick": "^3.1.3",
"ts-jest": "^27.1.2",
"typescript": "^4.5.4"
}
}
2 changes: 1 addition & 1 deletion client/src/components/molecules/ListColumn/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ type Props = {
};

export default function ListColumn({ children }: Props) {
return <Box display="flex" flexDirection="column" alignItems="center" children={children} />;
return <Box display="flex" flexDirection="column" alignItems="center">{children}</Box>;
}
2 changes: 1 addition & 1 deletion client/src/components/organisms/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function Search() {
return (
<Stack width="100%" spacing={4}>
<InputGroup>
<InputLeftElement pointerEvents="none" children={<Search2Icon color="brand" />} />
<InputLeftElement pointerEvents="none"><Search2Icon color="brand" /></InputLeftElement>
<Input
borderColor="gray.500"
borderRadius="full"
Expand Down
1 change: 1 addition & 0 deletions client/src/store/availabilities/slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const slice = createSlice({
},
});

// @ts-ignore
export const selectors = adapter.getSelectors((state: RootState) => state[name]);

export const { upsert } = slice.actions;
Expand Down
1 change: 1 addition & 0 deletions client/src/store/domains/slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const slice = createSlice({
},
});

// @ts-ignore
export const selectors = adapter.getSelectors((state: RootState) => state[name]);

export const { fetchDataSuccess, fetchDataFailure } = slice.actions;
Expand Down
60 changes: 34 additions & 26 deletions client/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,51 @@
{
"compilerOptions": {
"allowJs": true,
"alwaysStrict": true,
"baseUrl": "./src",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"jsx": "preserve",
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"incremental": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"noEmit": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "esnext",
"isolatedModules": true,
"jsx": "preserve",
"baseUrl": "./src",
"paths": {
"@/*": ["./*"],
"@assets/*": ["./assets/*"],
"@components/*": ["./components/*"],
"@store": ["./store"],
"@store/*": ["./store/*"],
"@test/*": ["../test/*"]
}
"@/*": [
"./*"
],
"@assets/*": [
"./assets/*"
],
"@components/*": [
"./components/*"
],
"@store": [
"./store"
],
"@store/*": [
"./store/*"
],
"@test/*": [
"../test/*"
]
},
},
"exclude": [
".next",
"node_modules"
],
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"node_modules"
]
}
}
Loading

0 comments on commit 18ca71d

Please sign in to comment.