From 7695362c491172d481364d396f6d467ae7d22b1b Mon Sep 17 00:00:00 2001 From: Maschell Date: Sat, 5 Sep 2020 11:33:54 +0200 Subject: [PATCH] Add dockerfile for building linux-x86-64 binaries --- .github/workflows/linux-x86-64.yml | 20 ++++++++++++++++++++ .github/workflows/pc-win.yml | 2 +- Dockerfile.pc | 12 ++++++++++++ README.md | 17 +++++++++++++++++ filelist.sh | 2 +- 5 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/linux-x86-64.yml create mode 100644 Dockerfile.pc diff --git a/.github/workflows/linux-x86-64.yml b/.github/workflows/linux-x86-64.yml new file mode 100644 index 0000000..b92b77a --- /dev/null +++ b/.github/workflows/linux-x86-64.yml @@ -0,0 +1,20 @@ +name: linux-x86-64 building. +on: + push: + branches: + - master +jobs: + build-binary: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: build binary + run: | + docker build . -f Dockerfile.pc -t sdl2_playground-builder-pc + docker run -it --rm -v ${PWD}:/project sdl2_playground-builder-pc bash -c "cd .. && bash filelist.sh" + docker run -it --rm -v ${PWD}:/project sdl2_playground-builder-pc cmake .. + docker run -it --rm -v ${PWD}:/project sdl2_playground-builder-pc make + - uses: actions/upload-artifact@master + with: + name: linux-x86-64-shared binary + path: "./cmake-build/SDL2_Playground" \ No newline at end of file diff --git a/.github/workflows/pc-win.yml b/.github/workflows/pc-win.yml index 4c69bf9..5b8847f 100644 --- a/.github/workflows/pc-win.yml +++ b/.github/workflows/pc-win.yml @@ -14,5 +14,5 @@ jobs: docker run --rm -v ${PWD}:/project sdl2_playground-builder-pc-win make -f Makefile.pc-win - uses: actions/upload-artifact@master with: - name: binary + name: windows-shared binary path: "*.exe" \ No newline at end of file diff --git a/Dockerfile.pc b/Dockerfile.pc new file mode 100644 index 0000000..25529c1 --- /dev/null +++ b/Dockerfile.pc @@ -0,0 +1,12 @@ +FROM debian:sid-slim +RUN DEBIAN_FRONTEND="noninteractive" +RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections +RUN apt-get update && \ + apt-get install -y --no-install-recommends apt-utils ca-certificates && \ + apt-get install -y --no-install-recommends build-essential make git && \ + apt-get install -y --no-install-recommends cmake && \ + apt-get install -y --no-install-recommends libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-dev && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* +RUN mkdir -p /project/cmake-build +WORKDIR /project/cmake-build \ No newline at end of file diff --git a/README.md b/README.md index eaca9fd..abb9bf7 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,23 @@ bash ./filelist.sh mkdir build && cd build && cmake .. && make ``` +Via docker: +``` +# Build the docker image +docker build . -f .\Dockerfile.pc -t sdl2_playground-builder-pc + +# Build filelist.h +docker run -it --rm -v ${PWD}:/project sdl2_playground-builder-pc bash -c "cd .. && bash filelist.sh" + +# Generate the makefile +docker run -it --rm -v ${PWD}:/project sdl2_playground-builder-pc cmake .. + +# build! +docker run -it --rm -v ${PWD}:/project sdl2_playground-builder-pc make + +# The result will be in ${PWD}/cmake-build +``` + ## Windows binaries ### Windows with devkitPros version of msys2 diff --git a/filelist.sh b/filelist.sh index 70d9dc7..cef6ee7 100644 --- a/filelist.sh +++ b/filelist.sh @@ -1,4 +1,4 @@ -#! /bin/bash +#!/bin/bash # # Automatic resource file list generation # Created by Dimok