feat: Dockerfile for Podman

Prepare `Dockerfile` for `podman` deployment instead of `docker`

Close #1569, will break docker and docker compose deployment

Co-authored-by: jellllly420 <64725601+jellllly420@users.noreply.github.com>
This commit is contained in:
n0k0m3 2022-08-28 20:47:29 -04:00
parent 0b806b4a0f
commit 66fe166c30
3 changed files with 38 additions and 7 deletions

View File

@ -10,22 +10,16 @@ RUN wget https://dl.google.com/android/repository/platform-tools-latest-linux.zi
rm platform-tools-latest-linux.zip && \
ln -s /platform-tools/adb /usr/bin/adb
# Create user
RUN useradd -m abc && \
usermod -G users abc
# Set remote and local dirs
WORKDIR /app
ENV SOURCE=./
RUN chown abc:abc /app
USER abc
# Install the base conda environment
ENV PYROOT=/app/pyroot
RUN mamba create --prefix $PYROOT python==3.7.6 -y
# Install the requirements to the conda environment
COPY --chown=abc:abc $SOURCE/requirements.txt /app/requirements.txt
COPY $SOURCE/requirements.txt /app/requirements.txt
RUN $PYROOT/bin/pip install -r /app/requirements.txt
# Initial download of UIAutomator2 is really slow with appetizer mirror (outside of China), switch to github

View File

@ -0,0 +1,36 @@
FROM condaforge/mambaforge:4.12.0-0
# Install dependencies
RUN apt update && \
apt install -y netcat unzip
# Install latest adb (41)
RUN wget https://dl.google.com/android/repository/platform-tools-latest-linux.zip && \
unzip platform-tools-latest-linux.zip && \
rm platform-tools-latest-linux.zip && \
ln -s /platform-tools/adb /usr/bin/adb
# Set remote and local dirs
WORKDIR /app
ENV SOURCE=./
# Add Chinese-friendly mirrors for conda
RUN conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/ && \
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ && \
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ && \
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
# Install the base conda environment
ENV PYROOT=/app/pyroot
RUN mamba create --prefix $PYROOT python==3.7.6 -y
# Install the requirements to the conda environment
COPY $SOURCE/requirements.txt /app/requirements.txt
RUN $PYROOT/bin/pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r /app/requirements.txt
# Initial download of UIAutomator2 is really slow with appetizer mirror (outside of China), switch to github
RUN sed -i "s#path = mirror_download(url,#path = cache_download(url,#" $PYROOT/lib/python3.7/site-packages/uiautomator2/init.py
# When running the image, mount the ALAS folder into the container
CMD $PYROOT/bin/python -m uiautomator2 init && \
$PYROOT/bin/python /app/AzurLaneAutoScript/gui.py

View File

@ -10,3 +10,4 @@ services:
build:
context: ./deploy/docker/
dockerfile: ./Dockerfile
# dockerfile: ./Dockerfile.cn