Skip to content

Commit

Permalink
linux: better docker building
Browse files Browse the repository at this point in the history
  • Loading branch information
elibroftw committed Apr 12, 2024
1 parent 7f1d40a commit 9e67fb8
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 16 deletions.
59 changes: 59 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
.ruff_cache/
.pytest_cache/
git/
github/
.idea/
.vscode/
__pycache__/
src/venv/
src/.venv/
build/
_build/
dist/
images/
test_files/
venv/
.venv/
src/.flatpak-builder
.env
settings.json
settings.json.bak
PySimpleGUI.py
PySimpleGUIWx.py
tempCodeRunnerFile.py
test.*
demo.py
error.log
music_caster.log*
resources/assets.png
.vs/
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
*.userprefs
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
test.txt
music_caster.log
music_caster.log1
resources/assets.png
settings.json.bak
*.syso
*.pid
music_caster.lock
music_caster.db
src/phantomjs/
32 changes: 17 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# WIP: Build an image capable of producing music-caster App Images# WIP: Build an image capable of producing music-caster App Images
# Base image: Fedora 37
FROM fedora:37
# running this image will build the music-caster source into an App Image
FROM fedora:latest
ENV PY=python3.12

# Install required tools
RUN dnf update -y && \
dnf install -y python3.12 python3.12-devel python3.12-virtualenv dnf-plugins-core libappindicator-gtk3 && \
dnf config-manager --set-enabled powertools && \
dnf install -y python3-tkinter

# Install pip for Python 3.12 (as it's not included by default)
RUN curl https://bootstrap.pypa.io/get-pip.py | python3.12

CMD cd /var/music-caster && \
python3.12 -m pip install --upgrade -r requirements.txt -r requirements-dev.txt && \
python3.12 -O -m PyInstaller --onefile build_files/onedir.spec
# install required tools
RUN dnf update -y
RUN dnf install -y $PY $PY-devel $PY-virtualenv dnf-plugins-core libappindicator-gtk3 python3-devel python3-tkinter python3-pyaudio
# install some dependencies here to reduce the dependencies installed at run time
RUN $PY -m pip install --upgrade pip
RUN $PY -m pip install pyaudio
COPY . music-caster
RUN cd music-caster && $PY -m pip install --upgrade -r requirements.txt
RUN rm -rf ./music-caster
# when running this image, need to mount the work directory to /var/music-caster
CMD if [ ! -d /var/music-caster ] ; then git clone https://github.com/elibroftw/music-caster/ /var/music-caster ; fi && cd /var/music-caster && \
$PY -m pip install --upgrade pip && \
$PY -m pip install --upgrade -r requirements.txt -r requirements-dev.txt && \
$PY -O -m PyInstaller --onefile build_files/onedir.spec
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,15 @@ Only I have access to this data, I will NEVER give it to anyone else. Will stop

[Developer Guide](https://github.com/elibroftw/music-caster/wiki/Developer-Guide)

### Linux Build Guide

- Define correct PY variable (requires rebuilding the image)
- Obtain the mc-builder Image
- Option A: `docker pull elibroftw/mc-builder`
- Option B: `docker build . -t elibroftw/mc-builder`
- Remember to have Docker desktop/daemon running already
- Build source code using: `docker run --rm --volume .:/var/music-caster elibroftw/mc-builder`

### Virtualenv

```sh
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
wheel
build_files/PyAudio-0.2.14-cp312-cp312-win_amd64.whl; sys_platform == 'win32'
pyaudio; sys_platform == 'darwin'
pywin32; sys_platform == 'win32'
pyaudio; sys_platform != 'win32'
pgi; sys_platform == 'linux'
testresources; sys_platform == 'linux'
ujson~=5.5
Expand Down

0 comments on commit 9e67fb8

Please sign in to comment.