Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
micthiesen committed Oct 17, 2024
0 parents commit e762b4c
Show file tree
Hide file tree
Showing 9 changed files with 602 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Docker Image CI

on:
push:
branches: [main]

env:
IMAGE_NAME: edgecontrol

jobs:
lint:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v2
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: |
requirements.txt
requirements-dev.txt
- name: Install dependencies
run: pip install -r requirements.txt
- name: Install dev dependencies
run: pip install -r requirements-dev.txt
- name: Run linters
run: ./scripts/lint.sh

push:
needs: lint
runs-on: ubuntu-latest
permissions:
packages: write
contents: read

steps:
- uses: actions/checkout@v4
- name: Build image
run: docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"

- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Push image
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
VERSION=$(echo "${{ github.sha }}" | cut -c 1-7)
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:latest
docker push --all-tags $IMAGE_ID
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM node:16-slim AS frontend-build

COPY packages/frontend /build
WORKDIR /build
RUN npm install

ENV NODE_ENV=production
RUN npm run build

FROM python:3.10-slim
ENV PYTHONUNBUFFERED=1

COPY --from=frontend-build /build/dist /www

COPY requirements.txt .
RUN pip install -r requirements.txt
RUN rm requirements.txt

COPY packages/backend /app
EXPOSE 5777:5777
ENTRYPOINT [ "python", "/app/main.py" ]
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Michael

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# EdgeControl

Control EdgeRouter X settings from an API.
22 changes: 22 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"linter": {
"enabled": true,
"rules": {
"style": {
"noUselessElse": "off",
"noNonNullAssertion": "off"
},
"suspicious": {
"noExplicitAny": "off",
"noShadowRestrictedNames": "off"
}
}
},
"formatter": {
"indentStyle": "space",
"lineWidth": 89
},
"organizeImports": {
"enabled": false
}
}
24 changes: 24 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "edgecontrol",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "tsx watch src/index.ts",
"typecheck": "tsc --noEmit",
"lint": "biome lint .",
"format": "biome format .",
"check": "biome check ."
},
"dependencies": {
"@hono/node-server": "^1.13.2",
"hono": "^4.6.5"
},
"devDependencies": {
"@biomejs/biome": "1.9.3",
"@types/node": "^20.11.17",
"typescript": "^5.0.4",
"tsx": "^4.7.1"
},
"packageManager": "[email protected]"
}
Loading

0 comments on commit e762b4c

Please sign in to comment.