Skip to content

Commit

Permalink
refactor: test on other os, update action, cleanup docker
Browse files Browse the repository at this point in the history
  • Loading branch information
Gauvino committed Jul 31, 2024
1 parent 878cafc commit 5317fae
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 42 deletions.
14 changes: 13 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
openbullet2-web-client/node_modules
Changelog/
.github
.git
.gitignore
.dockerignore
Dockerfile
Dockerfile.build
Dockerfile.remote
docker-compose.yml
CONTRIBUTORS.md
LICENSE
README.md
openbullet2-web-client/node_modules
10 changes: 5 additions & 5 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,26 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

# Read the version
- name: Read version
run: echo "VERSION=$(cat OpenBullet2.Web/version.txt)" >> $GITHUB_ENV

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

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v6
with:
push: true
file: ./Dockerfile.remote
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ jobs:
if: contains(github.event.head_commit.message, '[build]')
steps:
- uses: actions/checkout@v4

- name: Setup .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Unit and integration tests
run: dotnet test

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
if: contains(github.event.head_commit.message, '[build]')
steps:
- uses: actions/checkout@v4

- name: Setup .NET 8
uses: actions/setup-dotnet@v4
with:
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,19 @@ on:
- staging

jobs:
test:
runs-on: ubuntu-latest
run-tests:
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]

runs-on: "${{ matrix.os }}"
steps:
- uses: actions/checkout@v4

- name: Setup .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Unit and integration tests
run: dotnet test
34 changes: 25 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,35 @@ COPY --from=frontend /build ./wwwroot
COPY OpenBullet2.Web/dbip-country-lite.mmdb .

# Install dependencies
RUN apt-get update -yq && apt-get install -y --no-install-recommends apt-utils
RUN apt-get upgrade -yq && apt-get install -yq apt-utils curl git nano wget unzip python3 python3-pip
RUN echo "deb http://deb.debian.org/debian/ unstable main contrib non-free" >> /etc/apt/sources.list.d/debian.list \
&& apt-get update -yq \
&& apt-get install -y --no-install-recommends \
apt-utils \
&& apt-get upgrade -yq \
&& apt-get install -yq \
curl \
wget \
unzip \
git \
python3 \
python3-pip

# Setup nodejs
RUN curl -sL https://deb.nodesource.com/setup_current.x | bash - && apt-get install -yq nodejs build-essential
RUN echo "deb http://deb.debian.org/debian/ unstable main contrib non-free" >> /etc/apt/sources.list.d/debian.list
RUN curl -sL https://deb.nodesource.com/setup_current.x | bash - \
&& apt-get install -yq \
nodejs \
build-essential

# Install chromium and firefox for selenium and puppeteer
RUN apt-get update -yq && apt-get install -y --no-install-recommends firefox chromium
RUN pip3 install webdrivermanager || true
RUN webdrivermanager firefox chrome --linkpath /usr/local/bin || true

RUN apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update -yq && apt-get install -y --no-install-recommends firefox chromium \
&& pip3 install webdrivermanager || true \
&& webdrivermanager firefox chrome --linkpath /usr/local/bin || true

# Clean up
RUN apt-get remove curl wget unzip --yes \
&& apt-get clean autoclean --yes \
&& apt-get autoremove --yes \
&& rm -rf /var/cache/apt/archives* /var/lib/apt/lists/*

EXPOSE 5000
CMD ["dotnet", "./OpenBullet2.Web.dll", "--urls=http://*:5000"]
56 changes: 31 additions & 25 deletions Dockerfile.remote
Original file line number Diff line number Diff line change
@@ -1,50 +1,56 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0-bookworm-slim

ENV DEBIAN_FRONTEND=noninteractive
ENV DEBIAN_FRONTEND=noninteractive \
LC_ALL="en_US.UTF-8" \
LANG="en_US.UTF-8" \
LANGUAGE="en_US:en"

# Install basic dependencies
RUN apt-get update -yq \
&& apt-get install -y --no-install-recommends \
apt-utils \
curl \
git \
nano \
wget \
unzip \
python3 \
python3-pip \
gnupg \
lsb-release \
software-properties-common
&& apt-get install -y --no-install-recommends \
curl \
wget \
unzip \
gnupg \
git \
python3 \
python3-pip \
lsb-release \
software-properties-common

# Setup Node.js (LTS Version)
RUN curl -sL https://deb.nodesource.com/setup_lts.x | bash - \
&& apt-get install -yq nodejs build-essential
&& apt-get install -yq \
nodejs \
build-essential

# Add Mozilla Team PPA for the latest Firefox
RUN echo "deb http://ppa.launchpad.net/mozillateam/ppa/ubuntu focal main" | tee /etc/apt/sources.list.d/mozillateam-ppa.list \
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A6DCF7707EBC211F \
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9BDB3D89CE49EC21 \
&& apt-get update -yq
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A6DCF7707EBC211F \
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9BDB3D89CE49EC21 \
&& apt-get update -yq

# Install the latest Firefox and Chromium
RUN apt-get install -y --no-install-recommends \
firefox \
chromium
firefox \
chromium

# Install WebDriverManager
RUN pip3 install webdrivermanager || true \
&& webdrivermanager firefox chrome --linkpath /usr/local/bin || true

# Clean up
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
&& webdrivermanager firefox chrome --linkpath /usr/local/bin || true

WORKDIR /app

# Download and unpack the latest OpenBullet2.Web release
RUN wget https://github.com/openbullet/openbullet2/releases/latest/download/OpenBullet2.Web.zip \
&& unzip OpenBullet2.Web.zip \
&& rm OpenBullet2.Web.zip
&& unzip OpenBullet2.Web.zip \
&& rm OpenBullet2.Web.zip

# Clean up
RUN apt-get remove curl wget unzip gnupg --yes \
&& apt-get clean autoclean --yes \
&& apt-get autoremove --yes \
&& rm -rf /var/cache/apt/archives* /var/lib/apt/lists/*

EXPOSE 5000

Expand Down

0 comments on commit 5317fae

Please sign in to comment.