Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
markusressel committed Oct 17, 2022
2 parents 5801b8b + 7da973c commit d7aea91
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [ 3.8, 3.9 ]
python-version: [ "3.10" ]

steps:
- uses: actions/checkout@v1
Expand Down
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# Docker image for barcode-server

FROM python:3.10
# dont use alpine for python builds: https://pythonspeed.com/articles/alpine-docker-python/
FROM python:3.10-slim-buster

WORKDIR /app

COPY . .

RUN apt-get update \
&& apt-get -y install sudo
&& apt-get -y install sudo python3-pip python3-evdev \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
RUN pip install --upgrade pip;\
pip3 install evdev;\
pip install pipenv;\
pipenv install --system --deploy;\
PIP_IGNORE_INSTALLED=1 pipenv install --system --deploy;\
pip install .

ENV PUID=1000 PGID=1000
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
PROJECT=barcode_server

docker-image:
docker build . --file Dockerfile --tag markusressel/barcode-server:latest --no-cache

current-version:
set -ex
@echo "Current version is `cat ${PROJECT}/__init__.py | grep '__version__' | cut -d ' ' -f3 | sed s/\\\"//g`"
Expand Down
18 changes: 9 additions & 9 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: '3.8'

services:
barcode-server:
# build: .
image: markusressel/barcode-server:latest
environment:
- PUID=0
- PGID=0
devices:
- "/dev/input"
volumes:
# mount a YAML configuration file into /app/barcode_server.yaml:
- "./barcode_server.yaml:/app/barcode_server.yaml"
networks:
- docker-elk
ports:
- "8000:8000"
restart: on-failure
networks:
docker-elk:
driver: bridge
2 changes: 1 addition & 1 deletion tests/barcode_server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ barcode_server:
port: 9654
api_token: "EmUSqjXGfnQwn5wn6CpzJRZgoazMTRbMNgH7CXwkQG7Ph7stex"
devices:
- "Barcode/i"
- "Barcode"
stats:
port:
8 changes: 1 addition & 7 deletions tests/websocket_notifier_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from unittest.mock import MagicMock

import aiohttp
from aiohttp.test_utils import AioHTTPTestCase, unittest_run_loop
from aiohttp.test_utils import AioHTTPTestCase

from barcode_server import const
from barcode_server.barcode import BarcodeEvent
Expand Down Expand Up @@ -58,10 +58,6 @@ async def get_application(self):
await site.start()
return app

# the unittest_run_loop decorator can be used in tandem with
# the AioHTTPTestCase to simplify running
# tests that are asynchronous
@unittest_run_loop
async def test_ws_connect_and_event(self):
sample_event = create_barcode_event_mock("abcdefg")
server_id = self.config.INSTANCE_ID.value
Expand All @@ -88,7 +84,6 @@ async def test_ws_connect_and_event(self):

assert False

@unittest_run_loop
async def test_ws_reconnect_event_catchup(self):
server_id = self.config.INSTANCE_ID.value
missed_event = create_barcode_event_mock("abcdefg")
Expand Down Expand Up @@ -144,7 +139,6 @@ async def test_ws_reconnect_event_catchup(self):

assert False

@unittest_run_loop
async def test_ws_reconnect_drop_queue(self):
server_id = self.config.INSTANCE_ID.value
missed_event = create_barcode_event_mock("abcdefg")
Expand Down

0 comments on commit d7aea91

Please sign in to comment.