Skip to content

Commit

Permalink
Set-up Dockerfile and Container
Browse files Browse the repository at this point in the history
Setup Dockerfile and Container for easy Linux builds
  • Loading branch information
SirenGlitch committed Aug 26, 2023
1 parent 9826f0b commit c721593
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
22 changes: 8 additions & 14 deletions .github/workflows/build-executable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,21 @@ jobs:

build-linux:
runs-on: ubuntu-latest


container:
image: mygame:latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller

- name: Build Linux executable
run: |
pyinstaller --onefile --name="Game" --add-data "Assets:Assets" main.py
# The Docker container will run this command defined in the Dockerfile
- name: Upload Linux executable artifact
uses: actions/upload-artifact@v2
with:
name: Linux-Build
path: dist/Game

18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Use Ubuntu 22.04 as the base image
FROM ubuntu:22.04

# Set up environment
RUN apt-get update && apt-get install -y python3.9 python3-pip

# Install dependencies
RUN pip3 install --upgrade pip
RUN pip3 install pyinstaller

# Set the working directory
WORKDIR /app

# Copy your project files into the container
COPY . /app

# Run your compilation command
CMD ["pyinstaller", "--onefile", "--name=Game", "--add-data", "Assets:Assets", "main.py"]

0 comments on commit c721593

Please sign in to comment.