Skip to content

Commit a8c5f07

Browse files
committed
🚑 Hotfix Docker image with new NextJS version
1 parent 702428d commit a8c5f07

15 files changed

+625
-10160
lines changed

.eslintrc.js

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ module.exports = {
33
'mantine',
44
'plugin:@next/next/recommended',
55
'plugin:jest/recommended',
6-
'plugin:storybook/recommended',
76
"eslint:recommended",
87
"plugin:@typescript-eslint/eslint-recommended",
98
"plugin:@typescript-eslint/recommended"

.github/workflows/docker.yml

+29-48
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
name: Master docker CI
2-
# Workflow to build and publish docker image
3-
1+
name: Master CI
2+
# This workflow uses actions that are not certified by GitHub.
3+
# They are provided by a third-party and are governed by
4+
# separate terms of service, privacy policy, and support
5+
# documentation.
46
on:
57
push:
68
branches: [master]
@@ -22,72 +24,46 @@ jobs:
2224
# Push image to GitHub Packages.
2325
# See also https://docs.docker.com/docker-hub/builds/
2426
yarn_install_and_build:
25-
# Will run yarn install && yarn build
2627
runs-on: ubuntu-latest
28+
permissions:
29+
packages: write
30+
contents: read
2731
steps:
32+
2833
- name: Setup
2934
uses: actions/setup-node@v3
35+
3036
- name: Checkout
3137
uses: actions/checkout@v3
38+
3239
- name: Get yarn cache directory path
33-
# to help speed up build times
3440
id: yarn-cache-dir-path
35-
run: echo "::set-output name=dir::$(yarn cache dir)"
36-
- name: Yarn cache
37-
# to help speed up build times
38-
uses: actions/cache@v3
39-
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
41+
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
42+
43+
- uses: actions/cache@v3
44+
id: yarn-cache
4045
with:
4146
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
4247
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
43-
restore-keys: ${{ runner.os }}-yarn-
44-
- name: Nextjs cache
48+
restore-keys: |
49+
${{ runner.os }}-yarn-
50+
51+
- name: Restore NextJS cache
4552
uses: actions/cache@v2
4653
with:
47-
# See here for caching with `yarn` https://github.com/actions/cache/blob/main/examples.md#node---yarn or you can leverage caching with actions/setup-node https://github.com/actions/setup-node
54+
# See here for caching with `yarn` https://github.com/actions/cache/blob/main/examples.md#node---yarn or you can leverage caching with actions/setup-node https://github.com/actions/setup-node
4855
path: |
49-
~/.npm
5056
${{ github.workspace }}/.next/cache
5157
# Generate a new cache whenever packages or source files change.
5258
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
5359
# If source files changed but packages didn't, rebuild from a prior cache.
54-
restore-keys: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
60+
restore-keys: |
61+
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
62+
5563
- run: yarn install --immutable
64+
5665
- run: yarn build
57-
- name: Cache build output
58-
# to copy needed files to docker build job
59-
uses: actions/cache@v2
60-
id: restore-build
61-
with:
62-
path: |
63-
./next.config.js
64-
./pages/
65-
./public/
66-
./.next/static/
67-
./.next/standalone/
68-
./packages.json
69-
key: ${{ github.sha }}
7066

71-
docker_image_build_and_push:
72-
needs: [yarn_install_and_build]
73-
runs-on: ubuntu-latest
74-
permissions:
75-
packages: write
76-
contents: read
77-
steps:
78-
- name: Checkout
79-
uses: actions/checkout@v2
80-
- uses: actions/cache@v2
81-
id: restore-build
82-
with:
83-
path: |
84-
./next.config.js
85-
./pages/
86-
./public/
87-
./.next/static/
88-
./.next/standalone/
89-
./packages.json
90-
key: ${{ github.sha }}
9167
- name: Docker meta
9268
id: meta
9369
uses: docker/metadata-action@v4
@@ -98,10 +74,13 @@ jobs:
9874
tags: |
9975
type=raw,value=latest
10076
type=pep440,pattern={{version}}
77+
10178
- name: Set up QEMU
10279
uses: docker/setup-qemu-action@v2
80+
10381
- name: Set up Docker Buildx
10482
uses: docker/setup-buildx-action@v2
83+
10584
- name: Login to GHCR
10685
uses: docker/login-action@v2
10786
with:
@@ -117,3 +96,5 @@ jobs:
11796
push: true
11897
tags: ${{ steps.meta.outputs.tags }}
11998
labels: ${{ steps.meta.outputs.labels }}
99+
cache-from: type=gha
100+
cache-to: type=gha,mode=max

.github/workflows/docker_dev.yml

+16-46
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ jobs:
3030
# See also https://docs.docker.com/docker-hub/builds/
3131
yarn_install_and_build:
3232
runs-on: ubuntu-latest
33+
permissions:
34+
packages: write
35+
contents: read
3336
steps:
3437

3538
- name: Setup
@@ -40,66 +43,31 @@ jobs:
4043

4144
- name: Get yarn cache directory path
4245
id: yarn-cache-dir-path
43-
run: echo "::set-output name=dir::$(yarn cache dir)"
44-
45-
- name: Yarn cache
46-
uses: actions/cache@v3
47-
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
46+
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
47+
48+
- uses: actions/cache@v3
49+
id: yarn-cache
4850
with:
4951
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
5052
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
51-
restore-keys: ${{ runner.os }}-yarn-
53+
restore-keys: |
54+
${{ runner.os }}-yarn-
5255
53-
- name: Nextjs cache
56+
- name: Restore NextJS cache
5457
uses: actions/cache@v2
5558
with:
56-
# See here for caching with `yarn` https://github.com/actions/cache/blob/main/examples.md#node---yarn or you can leverage caching with actions/setup-node https://github.com/actions/setup-node
59+
# See here for caching with `yarn` https://github.com/actions/cache/blob/main/examples.md#node---yarn or you can leverage caching with actions/setup-node https://github.com/actions/setup-node
5760
path: |
58-
~/.npm
5961
${{ github.workspace }}/.next/cache
6062
# Generate a new cache whenever packages or source files change.
6163
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
6264
# If source files changed but packages didn't, rebuild from a prior cache.
63-
restore-keys: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
65+
restore-keys: |
66+
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
6467
6568
- run: yarn install --immutable
66-
- run: yarn build
67-
68-
- name: Cache build output
69-
uses: actions/cache@v2
70-
id: restore-build
71-
with:
72-
path: |
73-
./next.config.js
74-
./pages/
75-
./public/
76-
./.next/static/
77-
./.next/standalone/
78-
./packages.json
79-
key: ${{ github.sha }}
80-
81-
docker_image_build_and_push:
82-
needs: [yarn_install_and_build]
83-
runs-on: ubuntu-latest
84-
permissions:
85-
packages: write
86-
contents: read
87-
steps:
8869

89-
- name: Checkout
90-
uses: actions/checkout@v2
91-
92-
- uses: actions/cache@v2
93-
id: restore-build
94-
with:
95-
path: |
96-
./next.config.js
97-
./pages/
98-
./public/
99-
./.next/static/
100-
./.next/standalone/
101-
./packages.json
102-
key: ${{ github.sha }}
70+
- run: yarn build
10371

10472
- name: Docker meta
10573
id: meta
@@ -134,3 +102,5 @@ jobs:
134102
push: ${{ github.event_name != 'pull_request' }}
135103
tags: ${{ steps.meta.outputs.tags }}
136104
labels: ${{ steps.meta.outputs.labels }}
105+
cache-from: type=gha
106+
cache-to: type=gha,mode=max

.storybook/main.js

-30
This file was deleted.

.storybook/preview.tsx

-16
This file was deleted.

Dockerfile

+22-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
11
FROM node:16-alpine
22
WORKDIR /app
3+
4+
RUN apk add tzdata
5+
6+
ENV NEXT_TELEMETRY_DISABLED 1
7+
38
ENV NODE_ENV production
4-
COPY /next.config.js ./
5-
COPY /public ./public
6-
COPY /package.json ./package.json
7-
# Automatically leverage output traces to reduce image size. https://nextjs.org/docs/advanced-features/output-file-tracing
8-
COPY /.next/standalone ./
9-
COPY /.next/static ./.next/static
9+
10+
RUN addgroup --system --gid 1001 nodejs
11+
RUN adduser --system --uid 1001 nextjs
12+
13+
COPY next.config.js ./
14+
COPY public ./public
15+
COPY package.json ./package.json
16+
17+
# Automatically leverage output traces to reduce image size
18+
# https://nextjs.org/docs/advanced-features/output-file-tracing
19+
COPY --chown=nextjs:nodejs .next/standalone ./
20+
COPY --chown=nextjs:nodejs .next/static ./.next/static
21+
22+
USER nextjs
23+
1024
EXPOSE 7575
25+
1126
ENV PORT 7575
12-
RUN apk add tzdata
13-
VOLUME /app/data/configs
27+
1428
CMD ["node", "server.js"]

package.json

+5-12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "homarr",
33
"version": "0.8.2",
44
"description": "Homarr - A homepage for your server.",
5+
"license": "MIT",
56
"repository": {
67
"type": "git",
78
"url": "https://github.com/ajnart/homarr"
@@ -19,8 +20,6 @@
1920
"prettier:check": "prettier --check \"**/*.{ts,tsx}\"",
2021
"prettier:write": "prettier --write \"**/*.{ts,tsx}\"",
2122
"test": "npm run prettier:check && npm run lint && npm run typecheck && npm run jest",
22-
"storybook": "start-storybook -p 7001",
23-
"storybook:build": "build-storybook",
2423
"ci": "yarn test && yarn lint --fix && yarn typecheck && yarn prettier:write"
2524
},
2625
"dependencies": {
@@ -42,14 +41,13 @@
4241
"@nivo/core": "^0.79.0",
4342
"@nivo/line": "^0.79.1",
4443
"@tabler/icons": "^1.76.0",
45-
"add": "^2.0.6",
4644
"axios": "^0.27.2",
4745
"cookies-next": "^2.1.1",
4846
"dayjs": "^1.11.4",
4947
"dockerode": "^3.3.2",
5048
"framer-motion": "^6.5.1",
5149
"js-file-download": "^0.4.12",
52-
"next": "^12.2.3",
50+
"next": "12.2.0",
5351
"prism-react-renderer": "^1.3.5",
5452
"react": "^18.2.0",
5553
"react-dom": "^18.2.0",
@@ -58,10 +56,8 @@
5856
"yarn": "^1.22.19"
5957
},
6058
"devDependencies": {
61-
"@babel/core": "^7.18.9",
62-
"@next/bundle-analyzer": "^12.2.3",
63-
"@next/eslint-plugin-next": "^12.2.3",
64-
"@storybook/react": "^6.5.9",
59+
"@next/bundle-analyzer": "12.2.0",
60+
"@next/eslint-plugin-next": "12.2.0",
6561
"@types/dockerode": "^3.3.9",
6662
"@types/node": "^18.0.6",
6763
"@types/react": "^18.0.15",
@@ -77,14 +73,11 @@
7773
"eslint-plugin-jsx-a11y": "^6.6.1",
7874
"eslint-plugin-react": "^7.30.1",
7975
"eslint-plugin-react-hooks": "^4.6.0",
80-
"eslint-plugin-storybook": "^0.6.1",
8176
"eslint-plugin-testing-library": "^5.5.1",
8277
"eslint-plugin-unused-imports": "^2.0.0",
8378
"jest": "^28.1.3",
8479
"prettier": "^2.7.1",
85-
"require-from-string": "^2.0.2",
86-
"typescript": "^4.7.4",
87-
"yarn-upgrade-all": "^0.7.1"
80+
"typescript": "^4.7.4"
8881
},
8982
"packageManager": "[email protected]"
9083
}

0 commit comments

Comments
 (0)