Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker OSCAR updates #9

Merged
merged 2 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Docker Image CI

on:
push:
branches:
- 'main'
tags:
- "v*.*.*"
pull_request:
branches:
- 'main'
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
rogerrum/docker-oscar
ghcr.io/rogerrum/docker-oscar
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
type=semver,pattern={{version}}

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_TOKEN }}

- name: Output platforms
run: |
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"

- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/arm64,linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Docker Hub Description
if: github.event_name != 'pull_request'
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: rogerrum/docker-oscar

# Trivy test
- name: Run Trivy vulnerability scanner
if: github.event_name != 'pull_request'
uses: aquasecurity/trivy-action@master
id: trivy
with:
image-ref: 'ghcr.io/rogerrum/docker-oscar:${{ steps.meta.outputs.version }}'
format: 'sarif'
exit-code: '0'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
output: results.sarif

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
if: github.event_name != 'pull_request'
with:
sarif_file: 'results.sarif'
37 changes: 0 additions & 37 deletions .github/workflows/github-build.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea
.DS_Store

49 changes: 21 additions & 28 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,37 +1,30 @@
FROM golang:1.19-bullseye AS easy-novnc-build
WORKDIR /src
RUN go mod init build && \
go get github.com/geek1011/[email protected] && \
go build -o /bin/easy-novnc github.com/geek1011/easy-novnc
FROM ghcr.io/linuxserver/baseimage-kasmvnc:debianbullseye

FROM debian:bullseye

RUN apt-get update -y && \
apt-get install -y --no-install-recommends openbox tigervnc-standalone-server supervisor gosu && \
rm -rf /var/lib/apt/lists && \
mkdir -p /usr/share/desktop-directories

RUN apt-get update -y && \
apt-get install -y --no-install-recommends lxterminal nano wget openssh-client rsync ca-certificates xdg-utils htop tar xzip gzip bzip2 zip unzip && \
rm -rf /var/lib/apt/lists
ARG TARGETPLATFORM
ARG TARGETARCH
ARG TARGETVARIANT

ARG OSCAR_VERSION=1.5.1

RUN printf '%s' "Building for TARGETPLATFORM=${TARGETPLATFORM}" \
&& printf '%s' ", TARGETARCH=${TARGETARCH}" \
&& printf '%s' ", TARGETVARIANT=${TARGETVARIANT} \n"

RUN apt-get update -y && \
wget -q -O /tmp/oscar.deb https://www.apneaboard.com/OSCAR/oscar_1.4.0-Debian11_amd64.deb && \
apt install -y /tmp/oscar.deb && \
rm /tmp/oscar.deb && \
rm -rf /var/lib/apt/lists
apt-get install -y --no-install-recommends wget cron

COPY --from=easy-novnc-build /bin/easy-novnc /usr/local/bin/
COPY menu.xml /etc/xdg/openbox/
COPY supervisord.conf /etc/
EXPOSE 8080
RUN if [ "${TARGETARCH}" = "arm64" ]; then \
wget -q -O /tmp/oscar.deb https://www.apneaboard.com/OSCAR/oscar_${OSCAR_VERSION}-RasPiOS-11_arm64.deb; \
else \
wget -q -O /tmp/oscar.deb https://www.apneaboard.com/OSCAR/oscar_${OSCAR_VERSION}-Debian11_amd64.deb; \
fi

RUN groupadd --gid 1000 app && \
useradd --home-dir /data --shell /bin/bash --uid 1000 --gid 1000 app && \
mkdir -p /data
RUN apt install -y /tmp/oscar.deb && \
rm /tmp/oscar.deb && \
rm -rf /var/lib/apt/lists

#VOLUME /data
#RUN apk add --no-cache firefox
COPY /root /

CMD ["sh", "-c", "chown app:app /data /dev/stdout && exec gosu app supervisord"]
# ports and volumes
EXPOSE 3000
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

docker-oscar Copyright (C) 2022 Roger Rumao
docker-oscar Copyright (C) 2024 Roger Rumao
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
Expand Down
86 changes: 84 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,26 @@
[![DockerHub stars](https://img.shields.io/docker/stars/rogerrum/docker-oscar.svg)](https://hub.docker.com/r/rogerrum/docker-oscar/)
[![GitHub stars](https://img.shields.io/github/stars/rogerrum/docker-oscar.svg)](https://github.com/rogerrum/docker-oscar)
[![Contributors](https://img.shields.io/github/contributors/rogerrum/docker-oscar.svg)](https://github.com/rogerrum/docker-oscar/graphs/contributors)
[![Docker Image CI](https://github.com/rogerrum/docker-oscar/actions/workflows/docker-image.yml/badge.svg)](https://github.com/rogerrum/docker-oscar/actions/workflows/docker-image.yml)


A Docker image for **[OSCAR](https://www.sleepfiles.com/OSCAR/)** to run inside Docker container and access it remotely using web browser.


Repository name in Docker Hub: **[rogerrum/docker-oscar](https://hub.docker.com/r/rogerrum/docker-oscar/)**
Published via **automated build** mechanism

![img.png](https://raw.githubusercontent.com/rogerrum/docker-oscar/main/.github/demo-img.png)


## Docker Run
To simply do a quick and dirty run of the Oscar container:
```
docker run \
-d --rm \
--name oscar \
-v=${pwd}/oscar-data:/data \
-v=${pwd}/oscar-data:/config/Documents/OSCAR_Data \
-v=${pwd}/SDCARD:/config/SDCARD \
--publish=8080:8080 \
rogerrum/docker-oscar

Expand Down Expand Up @@ -50,8 +54,84 @@ services:
ports:
- 8080:8080
volumes:
- ./oscar-data:/data:rw
- ./oscar-data:/config/Documents/OSCAR_Data:rw
- ./SDCARD:/config/SDCARD:rw
environment:
TZ: "America/Chicago"
```

To start the container run:
```
$ docker-compose up -d
```

## Automatic configuration for downloading SD card data using ezSahre (Optional)

The docker image contains additional cronjob that pulls files from an [ezShare](https://www.aliexpress.us/item/3256805687404143.html) wifi SD card adpater.

### Steps for EZShare data cron

- [ezShare](https://www.aliexpress.us/item/3256805687404143.html) wifi SD adapter and an SD card, be sure to chose the combo for around $24! Configured and installed in your CPAP machine
- USB wifi adapter or Raspberry PI connected with wired and wifi (I use raspberry pi 3 which is connected using wired and using wifi to connect to ezShare)

### Steps for configuring Wifi if connected using Wired for network and wifi for ezshare
edit file `sudo vi /etc/netplan/50-cloud-init.yaml`

Add following lines under `network`

```
wifis:
wlan0:
optional: true
access-points:
"ezShareSSD":
password: "ezShare-PASSORD"
dhcp4: true
```
Save and then
```
sudo netplan --debug try
sudo netplan --debug generate
sudo netplan --debug apply
```

and finally reboot

```
$ sudo reboot
```
When its back up you should be able to SSH in and ping 192.168.4.1 which is the ezShare card.


```yaml
version: '3.8'
services:
oscar:
image: rogerrum/docker-oscar:latest
container_name: oscar
restart: unless-stopped
ports:
- 8080:8080
volumes:
- ./oscar-data:/config/Documents/OSCAR_Data:rw
- ./SDCARD:/config/SDCARD:rw
environment:
TZ: "America/Chicago"
CRON_HOUR: 11
CRON_MIN: 00
```

To start the container run:
```
$ docker-compose up -d
```
cron job is created only when env CRON_HOUR and CRON_MIN are passed.

### Additional Docker image for transferring data (Used as Kube Cron Job)

Repository name in Docker Hub: **[rogerrum/docker-oscar-cron](https://hub.docker.com/r/rogerrum/docker-oscar-cron/)**

Repository name in ghcr.io: **[rogerrum/docker-oscar-cron](https://ghcr.io/rogerrum/docker-oscar-cron)**

## Issues
https://github.com/rogerrum/docker-oscar/issues
Expand All @@ -60,6 +140,8 @@ https://github.com/rogerrum/docker-oscar/issues
* I am happy for any feedback! Create issues, discussions, ... feel free and involve!
* Send me a PR

## Contributors
EzShare-SdcardWifi-Downloader script by [Biorn1950](https://github.com/Biorn1950) --- https://github.com/Biorn1950/EzShare-SdcardWifi-Downloader

Software Licensing Information
------------------------------
Expand Down
Loading
Loading