Skip to content

Commit e0139bd

Browse files
committed
Add docker-compose example (closes #14)
1 parent eaed354 commit e0139bd

File tree

5 files changed

+46
-69
lines changed

5 files changed

+46
-69
lines changed

.env

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Your numeric uid and gid
2+
HOSTUID=
3+
HOSTGID=
4+
5+
# When run from the root of your project directory, this will be
6+
# the location in the container
7+
WORKSPACE="/workspace"
8+
9+
# Absolute or relative path to your AppImage build script
10+
SCRIPT="$WORKSPACE/path/to/script"
11+
12+
ENTRYPOINT="/entrypoint.sh"

.github/workflows/test.yml

Lines changed: 18 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ on:
99
branches: trunk
1010
paths:
1111
- 'action.yml'
12+
- 'docker-compose.yml'
1213
- '**test.yml'
1314
pull_request:
1415
branches: trunk
1516
paths:
1617
- 'action.yml'
18+
- 'docker-compose.yml'
1719
- '**test.yml'
1820

1921
env:
@@ -44,16 +46,24 @@ jobs:
4446
echo "VERSION=${{ github.sha }}" >> $GITHUB_ENV
4547
fi
4648
49+
- name: Install docker-compose
50+
run: |
51+
#sudo apt update
52+
#sudo apt upgrade -y
53+
sudo apt install -y docker-compose
54+
55+
- name: Checkout rmw
56+
uses: actions/checkout@v4
57+
with:
58+
path: _linuxdeploy_test
59+
4760
- name: Build AppImage
4861
run: |
49-
docker run -t \
50-
--rm \
51-
--platform=${{ matrix.platform }} \
52-
-e HOSTUID=$(id -u) \
53-
-e VERSION \
54-
-v $GITHUB_WORKSPACE:/workspace \
55-
-w /workspace \
56-
andy5995/linuxdeploy:v2-focal packaging/appimage/pre-appimage.sh
62+
export HOSTUID=$(id -u) HOSTGID=$(id -g)
63+
docker-compose -f _linuxdeploy_test/docker-compose.yml run --rm build
64+
env:
65+
SCRIPT: 'packaging/appimage/pre-appimage.sh'
66+
PLATFORM: ${{ matrix.platform }}
5767

5868
- name: Create sha256sum
5969
run: |
@@ -68,57 +78,3 @@ jobs:
6878
name: ${{ env.IMAGE_FILENAME }}
6979
path: ./out/*
7080
if-no-files-found: error
71-
72-
#test-netpanzer:
73-
#runs-on: ubuntu-latest
74-
#strategy:
75-
#matrix:
76-
#platform: [amd64]
77-
#steps:
78-
#- name: Checkout
79-
#uses: actions/checkout@v4
80-
#- name: Checkout netpanzer
81-
#uses: actions/checkout@v4
82-
#with:
83-
#repository: netpanzer/netpanzer
84-
#path: netpanzer
85-
#- name: Use action from self
86-
#uses: ./
87-
#with:
88-
#platform: ${{ matrix.platform }}
89-
#pre_appimage_script: rmw/packaging/appimage/pre
90-
#sudo apt install -y \
91-
#gettext \
92-
#liblua5.1-0-dev \
93-
#libphysfs-dev \
94-
#libsdl2-dev \
95-
#libsdl2-mixer-dev \
96-
#libsdl2-ttf-dev
97-
#build_commands: |
98-
#git clone --depth 1 https://github.com/netpanzer/netpanzer
99-
#cd netpanzer
100-
#meson setup _build -Dprefix=/usr
101-
#cd _build
102-
#ninja
103-
#install_to_appdir_commands: |
104-
#meson install --destdir=$APPDIR --skip-subprojects
105-
#linuxdeploy_output_version: $VERSION
106-
#linuxdeploy_args: |
107-
#-d netpanzer/support/win32/netpanzer.desktop \
108-
#--custom-apprun=netpanzer/support/appimage/AppRun \
109-
#--icon-file=netpanzer/netpanzer.png \
110-
#--icon-filename=netpanzer \
111-
#--executable $APPDIR/usr/bin/netpanzer \
112-
#--output appimage
113-
114-
#- name: Create sha256sum
115-
#run: |
116-
#cd out
117-
#sha256sum $IMAGE_FILENAME > $IMAGE_FILENAME.sha256sum
118-
119-
#- name: Upload AppImage
120-
#uses: actions/upload-artifact@v4
121-
#with:
122-
#name: ${{ env.IMAGE_FILENAME }}
123-
#path: ./out/*
124-
#if-no-files-found: error

README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,7 @@ version Ubuntu.
1919

2020
## Example usage
2121

22-
docker run -t \
23-
--rm \
24-
-e HOSTUID=$(id -u) \
25-
-e VERSION=test \
26-
-v $PWD:/workspace \
27-
-w /workspace \
28-
andy5995/linuxdeploy:v2-focal packaging/appimage/pre-appimage.sh
22+
docker-compose run --rm build
2923

3024
This is meant to be run from the source root of your project. Using the
3125
command above, your current directory will be mounted in the container at

docker-compose.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
services:
2+
build:
3+
environment:
4+
HOSTUID: ${HOSTUID}
5+
HOSTGID: ${HOSTGID}
6+
VERSION: ${VERSION}
7+
image: andy5995/linuxdeploy:v2-focal
8+
platform: ${PLATFORM:-linux/amd64}
9+
entrypoint: $ENTRYPOINT
10+
volumes:
11+
- $PWD:$WORKSPACE
12+
working_dir: $WORKSPACE
13+
command: $SCRIPT
14+
restart: "no"

entrypoint.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ if [ -z "$1" ]; then
2525
fi
2626

2727
usermod -u "$HOSTUID" builder
28+
groupmod -g "$HOSTGID" builder
2829
chown -R "$HOSTUID:$HOSTGID" /home/builder
2930

3031
# The docs state to use '-w /workdir when running the container, but switching

0 commit comments

Comments
 (0)