diff --git a/.github/workflows/onPush-master.yml b/.github/workflows/onPush-master.yml new file mode 100644 index 0000000..30b04c5 --- /dev/null +++ b/.github/workflows/onPush-master.yml @@ -0,0 +1,25 @@ +name: OnPush master & upload dev image + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_ID }} + password: ${{ secrets.DOCKER_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v3 + with: + push: true + tags: lomot/auto-checkin-uhr:latest + file: Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..492f452 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM python:3.7-slim + +# config app +ENV APP_HOME="/app" \ + APP_PATH="/app/server" + +# install packages & config docker +RUN pip install matplotlib numpy selenium \ + opencv-python undetected_chromedriver==3.0.3 + +RUN apt-get update && \ + apt-get -y install wget chromium chromium-driver && \ + apt-get -y autoremove && \ + apt-get clean + +RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ + echo "Asia/Shanghai" > /etc/timezone + +COPY ./* $APP_PATH/ + +WORKDIR ${APP_PATH} +CMD ["/usr/local/bin/python", "/app/server/main.py"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b7be41a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +version: "3" + +services: + uhr: + container_name: uhr + image: auto-checkin-uhr:latest + volumes: + - ./config.py:/app/server/config.py + restart: on-failure + stdin_open: true + tty: true + \ No newline at end of file