-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from cyator/main
ws,react-use-websockets,release pipepline,husky,conventional commits,updated documentation
- Loading branch information
Showing
45 changed files
with
10,543 additions
and
5,523 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Dockerfile | ||
.dockerignore | ||
node_modules | ||
npm-debug.log | ||
README.md | ||
.next | ||
docker | ||
.git | ||
.gitignore | ||
.vscode | ||
mosquitto.conf | ||
telegraf.conf | ||
.env*.local | ||
.next | ||
.swc | ||
docker-compose.yaml | ||
mosquitto-data | ||
mosquitto-log | ||
influxdb2 |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
|
||
name: CI | ||
|
||
# Controls when the workflow will run | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the "main" branch | ||
push: | ||
branches: [ "main" ] | ||
paths-ignore: | ||
- '*.md' | ||
|
||
pull_request: | ||
branches: [ "main" ] | ||
paths-ignore: | ||
- '*.md' | ||
|
||
env: | ||
# Use docker.io for Docker Hub if empty | ||
REGISTRY: ghcr.io | ||
# github.repository as <account>/<repo> | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
build: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Bump version and push tag | ||
if: github.event_name != 'pull_request' | ||
id: tag_version | ||
uses: mathieudutour/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# https://github.com/docker/login-action | ||
- name: Log into registry ${{ env.REGISTRY }} | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Extract metadata (tags, labels) for Docker | ||
# https://github.com/docker/metadata-action | ||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=semver,pattern={{version}},value=${{ steps.tag_version.outputs.new_tag }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
- name: Update "docker-compose.yaml" | ||
env: | ||
DOCKER_CLIENT_IMAGE: ${{ fromJSON(steps.meta.outputs.json).tags[0] }} | ||
run: | | ||
(rm -f docker-compose.yaml && envsubst > docker-compose.yaml) < docker-compose.yaml | ||
cat docker-compose.yaml | ||
mkdir release | ||
cp docker-compose.yaml mosquitto.conf telegraf.conf release/ | ||
- name: Archive Release | ||
uses: thedoctor0/zip-release@main | ||
with: | ||
type: 'zip' | ||
path: './release' | ||
filename: 'release.zip' | ||
|
||
- name: Create a GitHub release | ||
if: github.event_name != 'pull_request' | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
tag: ${{ steps.tag_version.outputs.new_tag }} | ||
name: Release ${{ steps.tag_version.outputs.new_tag }} | ||
body: ${{ steps.tag_version.outputs.changelog }} | ||
artifacts: "release.zip" | ||
generateReleaseNotes: true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,38 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
/.vscode | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
# testing | ||
/coverage | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
# next.js | ||
/.next/ | ||
/.swc/ | ||
/out/ | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
# production | ||
/build | ||
|
||
# Typescript v1 declaration files | ||
typings/ | ||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.pnpm-debug.log* | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
# local env files | ||
.env*.local | ||
*.env | ||
# vercel | ||
.vercel | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
*.env | ||
|
||
# next.js build output | ||
.next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env sh | ||
if ! head -1 "$1" | grep -qE "^(feat|fix|chore|docs|test|style|refactor|perf|build|ci|revert)(\(.+?\))?: .{1,}$"; then | ||
echo "Aborting commit. Your commit message is invalid." >&2 | ||
exit 1 | ||
fi | ||
if ! head -1 "$1" | grep -qE "^.{1,88}$"; then | ||
echo "Aborting commit. Your commit message is too long." >&2 | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
'**/*.js?(x)': (filenames) => | ||
`next lint --fix --file ${filenames | ||
.map((file) => file.split(process.cwd())[1]) | ||
.join(' --file ')}`, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Step 1. Rebuild the source code only when needed | ||
FROM node:18-alpine AS builder | ||
|
||
WORKDIR /app | ||
|
||
# Install dependencies based on the preferred package manager | ||
COPY package.json package-lock.json* ./ | ||
|
||
RUN npm ci; | ||
RUN \ | ||
if [ -f package-lock.json ]; then npm ci; \ | ||
else echo "package-lock.json not found." && exit 1; \ | ||
fi | ||
|
||
COPY . ./ | ||
|
||
# Environment variables must be present at build time | ||
# https://github.com/vercel/next.js/discussions/14030 | ||
|
||
#ARG MQTT_URI | ||
#ENV MQTT_URI=${MQTT_URI} | ||
|
||
# Uncomment the following line to disable telemetry at build time | ||
# ENV NEXT_TELEMETRY_DISABLED 1 | ||
RUN npm run build | ||
|
||
# Step 2. Production image, copy all the files and run next | ||
FROM node:18-alpine AS runner | ||
|
||
WORKDIR /app | ||
|
||
# Don't run production as root | ||
RUN addgroup --system --gid 1001 nodejs | ||
RUN adduser --system --uid 1001 nextjs | ||
USER nextjs | ||
|
||
COPY --from=builder /app/public ./public | ||
|
||
# Automatically leverage output traces to reduce image size | ||
# https://nextjs.org/docs/advanced-features/output-file-tracing | ||
# COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ | ||
# COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static | ||
|
||
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next | ||
COPY --from=builder --chown=nextjs:nodejs /app/config ./config | ||
COPY --from=builder --chown=nextjs:nodejs /app/node_modules ./node_modules | ||
COPY --from=builder --chown=nextjs:nodejs /app/package.json ./package.json | ||
COPY --from=builder --chown=nextjs:nodejs /app/server.js ./server.js | ||
|
||
# Environment variables must be redefined at run time | ||
#ARG MQTT_URI | ||
#ENV MQTT_URI=${MQTT_URI} | ||
|
||
# Uncomment the following line to disable telemetry at run time | ||
# ENV NEXT_TELEMETRY_DISABLED 1 | ||
|
||
CMD npm start |
Oops, something went wrong.