Skip to content

Commit 4f8bcb8

Browse files
authored
Merge pull request #1189 from mikecao/dev
v1.32.0
2 parents f55ba7b + ccec996 commit 4f8bcb8

13 files changed

Lines changed: 687 additions & 627 deletions

File tree

Dockerfile

Lines changed: 37 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,52 @@
1-
# Build image
2-
FROM node:12.22-alpine AS build
3-
ARG BASE_PATH
4-
ARG DATABASE_TYPE
1+
# Install dependencies only when needed
2+
FROM node:16-alpine AS deps
3+
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
4+
RUN apk add --no-cache libc6-compat
5+
WORKDIR /app
6+
COPY package.json yarn.lock ./
7+
RUN yarn install --frozen-lockfile
58

9+
# Rebuild the source code only when needed
10+
FROM node:16-alpine AS builder
611
ENV BASE_PATH=$BASE_PATH
712
ENV DATABASE_URL "postgresql://umami:umami@db:5432/umami"
813
ENV DATABASE_TYPE=$DATABASE_TYPE
14+
WORKDIR /app
15+
COPY --from=deps /app/node_modules ./node_modules
16+
COPY . .
917

10-
WORKDIR /build
11-
12-
RUN yarn config set --home enableTelemetry 0
13-
COPY package.json yarn.lock /build/
14-
15-
# Install only the production dependencies
16-
RUN yarn install --production --frozen-lockfile
17-
18-
# Cache these modules for production
19-
RUN cp -R node_modules/ prod_node_modules/
20-
21-
# Install development dependencies
22-
RUN yarn install --frozen-lockfile
18+
# Next.js collects completely anonymous telemetry data about general usage.
19+
# Learn more here: https://nextjs.org/telemetry
20+
# Uncomment the following line in case you want to disable telemetry during the build.
21+
ENV NEXT_TELEMETRY_DISABLED 1
2322

24-
COPY . /build
25-
RUN yarn next telemetry disable
2623
RUN yarn build
2724

28-
# Production image
29-
FROM node:12.22-alpine AS production
25+
# Production image, copy all the files and run next
26+
FROM node:16-alpine AS runner
3027
WORKDIR /app
3128

32-
# Copy cached dependencies
33-
COPY --from=build /build/prod_node_modules ./node_modules
29+
ENV NODE_ENV production
30+
# Uncomment the following line in case you want to disable telemetry during runtime.
31+
ENV NEXT_TELEMETRY_DISABLED 1
32+
33+
RUN addgroup --system --gid 1001 nodejs
34+
RUN adduser --system --uid 1001 nextjs
3435

35-
# Copy generated Prisma client
36-
COPY --from=build /build/node_modules/.prisma/ ./node_modules/.prisma/
36+
# You only need to copy next.config.js if you are NOT using the default configuration
37+
COPY --from=builder /app/next.config.js ./
38+
COPY --from=builder /app/public ./public
39+
COPY --from=builder /app/package.json ./package.json
3740

38-
COPY --from=build /build/yarn.lock /build/package.json ./
39-
COPY --from=build /build/.next ./.next
40-
COPY --from=build /build/public ./public
41+
# Automatically leverage output traces to reduce image size
42+
# https://nextjs.org/docs/advanced-features/output-file-tracing
43+
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
44+
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
4145

42-
USER node
46+
USER nextjs
4347

4448
EXPOSE 3000
45-
CMD ["yarn", "start"]
49+
50+
ENV PORT 3000
51+
52+
CMD ["node", "server.js"]

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,18 @@ See [Running on Railway](https://umami.is/docs/running-on-railway) to get starte
1919
- A server with Node.js 12 or newer
2020
- A database (MySQL or Postgresql)
2121

22+
### Install Yarn (if needed)
23+
24+
```
25+
npm install -g yarn
26+
```
27+
2228
### Get the source code and install packages
2329

2430
```
2531
git clone https://github.com/mikecao/umami.git
2632
cd umami
27-
npm install
33+
yarn install
2834
```
2935

3036
### Create database tables
@@ -67,13 +73,13 @@ The `HASH_SALT` is used to generate unique values for your installation.
6773
### Build the application
6874

6975
```bash
70-
npm run build
76+
yarn build
7177
```
7278

7379
### Start the application
7480

7581
```bash
76-
npm start
82+
yarn start
7783
```
7884

7985
By default this will launch the application on `http://localhost:3000`. You will need to either
@@ -104,8 +110,8 @@ To get the latest features, simply do a pull, install any new dependencies, and
104110

105111
```bash
106112
git pull
107-
npm install
108-
npm run build
113+
yarn install
114+
yarn build
109115
```
110116

111117
To update the Docker image, simply pull the new images and rebuild:

components/pages/Dashboard.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ export default function Dashboard() {
3232
return (
3333
<Page>
3434
<PageHeader>
35-
<div>Dashboard</div>
35+
<div>
36+
<FormattedMessage id="label.dashboard" defaultMessage="Dashboard" />
37+
</div>
3638
<DashboardSettingsButton />
3739
</PageHeader>
3840
<WebsiteList websites={data} showCharts={showCharts} limit={max} />

hooks/useFetch.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ import useApi from './useApi';
55
export default function useFetch(url, options = {}, update = []) {
66
const [response, setResponse] = useState();
77
const [error, setError] = useState();
8-
const [loading, setLoadiing] = useState(false);
8+
const [loading, setLoading] = useState(false);
99
const [count, setCount] = useState(0);
1010
const { get } = useApi();
1111
const { params = {}, headers = {}, disabled, delay = 0, interval, onDataLoad } = options;
1212

1313
async function loadData(params) {
1414
try {
15-
setLoadiing(true);
15+
setLoading(true);
1616
setError(null);
1717
const time = performance.now();
1818

@@ -32,7 +32,7 @@ export default function useFetch(url, options = {}, update = []) {
3232
console.error(e);
3333
setError(e);
3434
} finally {
35-
setLoadiing(false);
35+
setLoading(false);
3636
}
3737
}
3838

lang/de-DE.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"label.settings": "Einstellungen",
5252
"label.share-url": "Freigabe-URL",
5353
"label.single-day": "Ein Tag",
54-
"label.theme": "Theme",
54+
"label.theme": "Thema",
5555
"label.this-month": "Diesen Monat",
5656
"label.this-week": "Diese Woche",
5757
"label.this-year": "Dieses Jahr",
@@ -92,7 +92,7 @@
9292
"metrics.countries": "Länder",
9393
"metrics.device.desktop": "Desktop",
9494
"metrics.device.laptop": "Laptop",
95-
"metrics.device.mobile": "Mobiltelefon",
95+
"metrics.device.mobile": "Handy",
9696
"metrics.device.tablet": "Tablet",
9797
"metrics.devices": "Geräte",
9898
"metrics.events": "Ereignisse",

next.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ module.exports = {
66
VERSION: pkg.version,
77
},
88
basePath: process.env.BASE_PATH,
9+
experimental: {
10+
outputStandalone: true,
11+
},
912
eslint: {
1013
ignoreDuringBuilds: true,
1114
},

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "umami",
3-
"version": "1.31.0",
3+
"version": "1.32.0",
44
"description": "A simple, fast, privacy-focused alternative to Google Analytics.",
55
"author": "Mike Cao <mike@mikecao.com>",
66
"license": "MIT",
@@ -54,7 +54,7 @@
5454
},
5555
"dependencies": {
5656
"@fontsource/inter": "4.5.7",
57-
"@prisma/client": "3.12.0",
57+
"@prisma/client": "3.14.0",
5858
"bcryptjs": "^2.4.3",
5959
"chalk": "^4.1.1",
6060
"chart.js": "^2.9.4",
@@ -112,10 +112,10 @@
112112
"postcss": "^8.4.12",
113113
"postcss-flexbugs-fixes": "^5.0.2",
114114
"postcss-import": "^14.0.2",
115-
"postcss-preset-env": "^7.4.2",
115+
"postcss-preset-env": "7.4.3",
116116
"postcss-rtlcss": "^3.6.1",
117117
"prettier": "^2.6.2",
118-
"prisma": "3.12.0",
118+
"prisma": "3.14.0",
119119
"prompts": "2.4.2",
120120
"rollup": "^2.70.1",
121121
"rollup-plugin-terser": "^7.0.2",

pages/_app.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const Intl = ({ children }) => {
2424
export default function App({ Component, pageProps }) {
2525
const { basePath } = useRouter();
2626
const { dir } = useLocale();
27-
const version = process.env.VERSION;
2827

2928
return (
3029
<Intl>
@@ -35,12 +34,6 @@ export default function App({ Component, pageProps }) {
3534
<link rel="icon" type="image/png" sizes="16x16" href={`${basePath}/favicon-16x16.png`} />
3635
<link rel="manifest" href={`${basePath}/site.webmanifest`} />
3736
<link rel="mask-icon" href={`${basePath}/safari-pinned-tab.svg`} color="#5bbad5" />
38-
<link
39-
rel="preload"
40-
href={`https://i.umami.is/icon.png?v=${version}`}
41-
as="image"
42-
type="image/png"
43-
/>
4437
<meta name="msapplication-TileColor" content="#da532c" />
4538
<meta name="theme-color" content="#fafafa" media="(prefers-color-scheme: light)" />
4639
<meta name="theme-color" content="#2f2f2f" media="(prefers-color-scheme: dark)" />

pages/_middleware.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function customScriptName(req) {
1717

1818
function disableLogin(req) {
1919
if (process.env.DISABLE_LOGIN && req.nextUrl.pathname.endsWith('/login')) {
20-
return new Response('403 Forbidden', { status: 403 });
20+
return new Response('Login is disabled', { status: 403 });
2121
}
2222
}
2323

public/intl/messages/de-DE.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@
334334
"label.theme": [
335335
{
336336
"type": 0,
337-
"value": "Theme"
337+
"value": "Thema"
338338
}
339339
],
340340
"label.this-month": [
@@ -704,7 +704,7 @@
704704
"metrics.device.mobile": [
705705
{
706706
"type": 0,
707-
"value": "Mobiltelefon"
707+
"value": "Handy"
708708
}
709709
],
710710
"metrics.device.tablet": [

0 commit comments

Comments
 (0)