Skip to content

Commit b02e3c6

Browse files
authored
Merge branch 'nightscout:master' into master
2 parents f1a18a1 + 21e0591 commit b02e3c6

File tree

142 files changed

+8901
-10176
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+8901
-10176
lines changed

.browserslistrc

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Browsers we support
2+
# See https://github.com/browserslist/browserslist for details
3+
4+
> 0.25%
5+
ios_saf 9.3
6+
ios_saf 10.3
7+
ios_saf 13.7
8+
ios_saf 14.8
9+
not dead
10+
not and_uc 12.12
11+
not ie 11
12+

.github/workflows/codeql-analysis.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ on:
1717
branches: [ dev ]
1818
pull_request:
1919
# The branches below must be a subset of the branches above
20-
branches: [ master ]
20+
branches: [ dev ]
2121
schedule:
2222
- cron: '43 23 * * 3'
2323

@@ -37,11 +37,11 @@ jobs:
3737

3838
steps:
3939
- name: Checkout repository
40-
uses: actions/checkout@v2
40+
uses: actions/checkout@v3
4141

4242
# Initializes the CodeQL tools for scanning.
4343
- name: Initialize CodeQL
44-
uses: github/codeql-action/init@v1
44+
uses: github/codeql-action/init@v2
4545
with:
4646
languages: ${{ matrix.language }}
4747
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -52,7 +52,7 @@ jobs:
5252
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5353
# If this step fails, then you should remove it and run the build manually (see below)
5454
- name: Autobuild
55-
uses: github/codeql-action/autobuild@v1
55+
uses: github/codeql-action/autobuild@v2
5656

5757
# ℹ️ Command-line programs to run using the OS shell.
5858
# 📚 https://git.io/JvXDl
@@ -66,4 +66,4 @@ jobs:
6666
# make release
6767

6868
- name: Perform CodeQL Analysis
69-
uses: github/codeql-action/analyze@v1
69+
uses: github/codeql-action/analyze@v2

.github/workflows/main.yml

+35-38
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ jobs:
1616
runs-on: ubuntu-latest
1717
strategy:
1818
matrix:
19-
node-version: [12.x, 14.x]
20-
mongodb-version: [4.2, 4.4]
19+
node-version: [14.x, 16.x]
20+
mongodb-version: [4.4, 5.0, 6.0]
2121

2222
steps:
2323
- name: Git Checkout
24-
uses: actions/checkout@v2
24+
uses: actions/checkout@v3
2525

2626
- name: Use Node.js ${{ matrix.node-version }}
27-
uses: actions/setup-node@v1
27+
uses: actions/setup-node@v3
2828
with:
2929
node-version: ${{ matrix.node-version }}
3030

@@ -40,54 +40,51 @@ jobs:
4040
- name: Send Coverage
4141
run: npm run-script coverage
4242

43-
publish_dev:
44-
name: Publish dev branch to Docker Hub
43+
publish:
44+
name: Publish to Docker Hub
4545
needs: test
4646
runs-on: ubuntu-latest
47-
if: github.ref == 'refs/heads/dev' && github.repository_owner == 'nightscout'
47+
if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev') && github.repository_owner == 'nightscout'
4848
env:
4949
DOCKER_IMAGE: nightscout/cgm-remote-monitor
50+
PLATFORMS: linux/amd64,linux/arm64
5051
steps:
52+
- name: Set up QEMU
53+
uses: docker/setup-qemu-action@v1
54+
- name: Set up Docker Buildx
55+
uses: docker/setup-buildx-action@v1
5156
- name: Login to Docker Hub
5257
uses: docker/login-action@v1
5358
with:
5459
username: ${{ secrets.DOCKER_USER }}
5560
password: ${{ secrets.DOCKER_PASS }}
5661
- name: Clean git Checkout
5762
if: success()
58-
uses: actions/checkout@v2
63+
uses: actions/checkout@v3
5964
- name: Build, tag and push the dev Docker image
60-
if: success()
61-
run: |
62-
docker build --no-cache=true -t ${{ env.DOCKER_IMAGE }}:dev_${{ github.sha }} .
63-
docker image push ${{ env.DOCKER_IMAGE }}:dev_${{ github.sha }}
64-
docker tag ${{ env.DOCKER_IMAGE }}:dev_${{ github.sha }} ${{ env.DOCKER_IMAGE }}:latest_dev
65-
docker image push ${{ env.DOCKER_IMAGE }}:latest_dev
66-
67-
publish_master:
68-
name: Publish master branch to Docker Hub
69-
needs: test
70-
runs-on: ubuntu-latest
71-
if: github.ref == 'refs/heads/master' && github.repository_owner == 'nightscout'
72-
env:
73-
DOCKER_IMAGE: nightscout/cgm-remote-monitor
74-
steps:
75-
- name: Login to Docker Hub
76-
uses: docker/login-action@v1
65+
if: success() && github.ref == 'refs/heads/dev'
66+
uses: docker/build-push-action@v2
7767
with:
78-
username: ${{ secrets.DOCKER_USER }}
79-
password: ${{ secrets.DOCKER_PASS }}
80-
- name: Clean git Checkout
81-
if: success()
82-
uses: actions/checkout@v2
83-
- name: get-npm-version
84-
if: success()
68+
context: .
69+
push: true
70+
no-cache: true
71+
platforms: ${{ env.PLATFORMS }}
72+
tags: |
73+
${{ env.DOCKER_IMAGE }}:dev_${{ github.sha }}
74+
${{ env.DOCKER_IMAGE }}:latest_dev
75+
76+
- name: Get Nightscout release version
77+
if: success() && github.ref == 'refs/heads/master'
8578
id: package-version
8679
uses: martinbeentjes/npm-get-version-action@master
8780
- name: Build, tag and push the master Docker image
88-
if: success()
89-
run: |
90-
docker build --no-cache=true -t ${{ env.DOCKER_IMAGE }}:${{ steps.package-version.outputs.current-version }} .
91-
docker image push ${{ env.DOCKER_IMAGE }}:${{ steps.package-version.outputs.current-version }}
92-
docker tag ${{ env.DOCKER_IMAGE }}:${{ steps.package-version.outputs.current-version }} ${{ env.DOCKER_IMAGE }}:latest
93-
docker image push ${{ env.DOCKER_IMAGE }}:latest
81+
if: success() && github.ref == 'refs/heads/master'
82+
uses: docker/build-push-action@v2
83+
with:
84+
context: .
85+
push: true
86+
no-cache: true
87+
platforms: ${{ env.PLATFORMS }}
88+
tags: |
89+
${{ env.DOCKER_IMAGE }}:${{ steps.package-version.outputs.current-version }}
90+
${{ env.DOCKER_IMAGE }}:latest

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
14.15.3
1+
16.16.0

Dockerfile

+12-7
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
1-
FROM node:14.15.3-alpine
1+
FROM node:16.16.0-alpine
22

33
LABEL maintainer="Nightscout Contributors"
44

5-
RUN mkdir -p /opt/app
6-
ADD . /opt/app
75
WORKDIR /opt/app
8-
RUN chown -R node:node /opt/app
9-
USER node
6+
ADD . /opt/app
107

11-
RUN npm install && \
8+
# TODO: We should be able to do `RUN npm install --only=production`.
9+
# For this to work, we need to copy only package.json and things needed for `npm`'s to succeed.
10+
# TODO: Do we need to re-add `npm audit fix`? Or should that be part of a development process/stage?
11+
RUN npm install --cache /tmp/empty-cache && \
1212
npm run postinstall && \
1313
npm run env && \
14-
npm audit fix
14+
rm -rf /tmp/*
15+
# TODO: These should be added in the future to correctly cache express-minify content to disk
16+
# Currently, doing this breaks the browser cache.
17+
# mkdir /tmp/public && \
18+
# chown node:node /tmp/public
1519

20+
USER node
1621
EXPOSE 1337
1722

1823
CMD ["node", "lib/server/server.js"]

0 commit comments

Comments
 (0)