Skip to content

Commit ede55b1

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

File tree

5 files changed

+49
-15
lines changed

5 files changed

+49
-15
lines changed

.env

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

.github/workflows/test.yml

Lines changed: 19 additions & 8 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,25 @@ 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+
VERSION: $VERSION
67+
PLATFORM: ${{ matrix.platform }}
5768

5869
- name: Create sha256sum
5970
run: |

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: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
services:
2+
build:
3+
environment:
4+
HOSTUID: ${HOSTUID}
5+
HOSTGID: ${HOSTGID}
6+
VERSION: ${VERSION}
7+
image: andy5995/linuxdeploy:v2-focal
8+
entrypoint: $ENTRYPOINT
9+
volumes:
10+
- $PWD:$WORKSPACE
11+
working_dir: $WORKSPACE
12+
command: $SCRIPT
13+
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)