Skip to content

Commit

Permalink
allow arm builds
Browse files Browse the repository at this point in the history
  • Loading branch information
zefanjajobse committed Mar 16, 2024
1 parent b8cbaaf commit 00210d3
Show file tree
Hide file tree
Showing 43 changed files with 13,902 additions and 450 deletions.
57 changes: 42 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,51 @@
FROM ubuntu:23.04 AS build-stage

RUN apt-get update && apt-get install -y libgeoip-dev libmysqlclient-dev build-essential && apt-get clean

COPY gslist /gslist

WORKDIR /gslist

RUN make

FROM python:3.12 AS requirements-stage
WORKDIR /tmp

RUN pip install poetry poetry-plugin-export
COPY ./bf2-worker/pyproject.toml ./poetry.lock* /tmp/
RUN poetry export -f requirements.txt --output requirements.txt --without-hashes

FROM ubuntu:23.04
RUN apt-get update
RUN apt-get install -y wget software-properties-common gnupg2 xvfb

RUN dpkg --add-architecture i386
RUN mkdir -pm755 /etc/apt/keyrings
RUN wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key
RUN wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/lunar/winehq-lunar.sources
RUN apt-get update
RUN apt-get install --no-install-recommends -y winehq-stable winetricks winbind python3 curl python3-poetry python-is-python3
# AMD64 build for bfbc2
# RUN apt-get install -y wget software-properties-common gnupg2 xvfb
# RUN dpkg --add-architecture i386
# RUN mkdir -pm755 /etc/apt/keyrings
# RUN wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key
# RUN wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/lunar/winehq-lunar.sources
# RUN apt-get update
# RUN apt-get install --no-install-recommends -y winehq-stable winetricks winbind

# ARM build for bfbc2
# WORKDIR /temp
# ADD https://github.com/AndreRH/hangover/releases/download/hangover-9.3/hangover_9.3_ubuntu2310_mantic_arm64.tar /temp
# RUN tar -xvf hangover_9.3_ubuntu2310_mantic_arm64.tar
# RUN apt-get update && apt-get install -y ./hangover-wine_9.3~mantic_arm64.deb

ENV WINEDEBUG=fixme-all
ENV DISPLAY :0
RUN apt-get update && apt-get install -y python3 curl python3-pip python3-venv python-is-python3 && apt-get clean
# ENV WINEDEBUG=fixme-all
# ENV DISPLAY :0

COPY ./pyproject.toml /pyproject.toml
COPY ./poetry.lock /poetry.lock
RUN poetry config virtualenvs.create false
# Set pip env
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"

RUN poetry install --only main
COPY --from=requirements-stage /tmp/requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt

COPY . /bf2-api
COPY ./bf2-worker /bf2-api
COPY ./ealist /bf2-api/ealist
COPY --from=build-stage /gslist/gslist /bf2-api/gslist-2
WORKDIR /bf2-api

ENTRYPOINT [ "python3.11", "serverList.py" ]
File renamed without changes.
File renamed without changes.
434 changes: 434 additions & 0 deletions bf2-worker/poetry.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions pyproject.toml → bf2-worker/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ readme = "README.md"

[tool.poetry.dependencies]
python = "^3.11"
pymongo = "^4.5.0"
Flask = "^3.0.0"
Quart = "^0.19.3"
hypercorn = "^0.15.0"
jinja2 = "^3.1.2"
pymongo = "^4.6.2"
Flask = "^3.0.2"
Quart = "^0.19.4"
hypercorn = "^0.16.0"
jinja2 = "^3.1.3"

[build-system]
requires = ["poetry-core"]
Expand Down
13 changes: 7 additions & 6 deletions serverList.py → bf2-worker/serverList.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Get server lists from games and insert them into the database."""

import asyncio
from threading import Thread
from subprocess import run, TimeoutExpired
Expand Down Expand Up @@ -116,12 +117,12 @@ async def main_loop(main_db: MongoClient):
"-n bfvietnam -x master2.qtracker.com:28900 -Y bfvietnam h2P9dJ -t 2 -Q 0 -q",
"bfvietnam-qtracker",
)
ealist_gather(
main_db,
"mohair-pc -n bfbc2-pc-server -X none -o 1",
"bfbc2-pc-server.gsl",
"bfbc2",
)
# ealist_gather(
# main_db,
# "mohair-pc -n bfbc2-pc-server -X none -o 1",
# "bfbc2-pc-server.gsl",
# "bfbc2",
# )
await asyncio.sleep(10) # 10 seconds


Expand Down
11 changes: 11 additions & 0 deletions build.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM ubuntu:23.04

RUN apt-get update && apt-get install -y libssl-dev build-essential && apt-get clean

COPY ealist /ealist

WORKDIR /ealist

RUN make

RUN ./ealist
7 changes: 7 additions & 0 deletions ealist/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
SRC = ealist.c
LIBS = -lssl -lcrypto

all: ealist

ealist:
$(CC) $(SRC) $(CFLAGS) -o ealist $(LIBS)
4 changes: 2 additions & 2 deletions ealist/ealist.c
Original file line number Diff line number Diff line change
Expand Up @@ -1614,7 +1614,7 @@ int recv_tcp(SSL *ssl_sd, int sd, u8 *data, int datalen) {



static const u8 SSL_CERT_X509[] = // x509 –in input.crt –inform PEM –out output.crt –outform DER
static const u8 SSL_CERT_X509[] = // x509 in input.crt inform PEM out output.crt outform DER
"\x30\x82\x03\x07\x30\x82\x02\x70\xa0\x03\x02\x01\x02\x02\x09\x00"
"\x85\x3a\x6e\x0a\xa4\x3c\x6b\xec\x30\x0d\x06\x09\x2a\x86\x48\x86"
"\xf7\x0d\x01\x01\x05\x05\x00\x30\x61\x31\x0b\x30\x09\x06\x03\x55"
Expand Down Expand Up @@ -1665,7 +1665,7 @@ int recv_tcp(SSL *ssl_sd, int sd, u8 *data, int datalen) {
"\x15\x69\xce\x4a\x73\x3b\xee\x12\x4d\x1c\x63\x11\x9b\xdf\x4d\xa1"
"\x38\x0d\xb6\x1d\xfb\xd6\xb8\x5b\xc2\x10\xd9";

static const u8 SSL_CERT_RSA[] = // rsa –in input.key –inform PEM –out output.key –outform DER
static const u8 SSL_CERT_RSA[] = // rsa in input.key inform PEM out output.key outform DER
"\x30\x82\x02\x5b\x02\x01\x00\x02\x81\x81\x00\xc5\xe3\x3f\x2d\x8f"
"\x98\xc2\x2a\xef\x71\xea\x40\x21\x54\x3f\x08\x62\x9c\x7b\x39\x22"
"\xfd\xda\x80\x1f\x21\x3e\x8d\x68\xcf\x8e\x6b\x70\x98\x95\x2c\x1e"
Expand Down
Binary file removed gslist-2
Binary file not shown.
58 changes: 58 additions & 0 deletions gslist/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Prerequisites
*.d

# Object files
*.o
*.ko
*.obj
*.elf

# Linker output
*.ilk
*.map
*.exp

# Precompiled Headers
*.gch
*.pch

# Libraries
*.lib
*.a
*.la
*.lo

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# Debug files
*.dSYM/
*.su
*.idb
*.pdb

# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf

*.gsl

gslist

gslistsql
Loading

0 comments on commit 00210d3

Please sign in to comment.