add image for building appimages

This commit is contained in:
2022-02-22 11:36:44 +01:00
parent 1191a7a5e6
commit b12e6f3d90
6 changed files with 122 additions and 2 deletions

View File

@@ -0,0 +1,67 @@
name: build-push-tagged
on:
push:
tags:
- '*.*.*'
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
# TO get the tag name
- name: Get the tag name
run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v2
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/13hannes11/gtk4-rs-docker
# generate Docker tags based on the following events/attributes
flavor: |
latest=auto
prefix=appimage_,onlatest=true
tags:
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: appimage
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View File

@@ -6,16 +6,21 @@ This repository contains the build instructions for a rust libadwaita gtk app. A
To build the image go to the main repository and run: To build the image go to the main repository and run:
### BaseImage ### BaseImage
``` ```
docker build base -t gtk4-rs-docker docker build base -t gtk4-rs-docker
``` ```
### AppImage
```
docker build appimage -t gtk4-rs-docker
```
## Compiling the example application ## Compiling the example application
To compile the example application use docker-compose (note your system needs `libadwaita` to run the example application): To compile the example application use docker-compose (note your system needs `libadwaita` to run the example application unless you build the AppImage):
``` ```
docker-compose up docker-compose up

View File

@@ -1 +1,4 @@
/target /target
/libs
*.AppImage
*.png

View File

@@ -6,3 +6,11 @@ edition = "2021"
[dependencies] [dependencies]
adw = { version = "0.1", package = "libadwaita" } adw = { version = "0.1", package = "libadwaita" }
gtk = { version = "0.4", package = "gtk4" } gtk = { version = "0.4", package = "gtk4" }
[package.metadata.appimage]
auto_link = true
auto_link_exclude_list = [
"libc.so*",
"libdl.so*",
"libpthread.so*",
]

30
appimage/Dockerfile Normal file
View File

@@ -0,0 +1,30 @@
FROM fedora:latest
ENV RUST_VERSION=1.58.1
RUN dnf install gtk4-devel gcc libadwaita-devel -y
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
RUN . ~/.cargo/env
RUN ls $HOME/.cargo/env
ENV PATH=/root/.cargo/bin:$PATH
RUN rustup install ${RUST_VERSION}
ENV APPIMAGE_VERSION=13
ENV APPIMAGE_EXTRACT_AND_RUN=1
RUN cargo install cargo-appimage
RUN dnf install wget -y
RUN wget https://github.com/AppImage/AppImageKit/releases/download/$APPIMAGE_VERSION/appimagetool-x86_64.AppImage
RUN chmod +x appimagetool-x86_64.AppImage
RUN ./appimagetool-x86_64.AppImage --appimage-extract
RUN ls
RUN ln -nfs /squashfs-root/usr/bin/appimagetool /usr/bin/appimagetool
RUN dnf install file desktop-file-utils appstream -y
WORKDIR /mnt
CMD ["/bin/bash"]

View File

@@ -0,0 +1,7 @@
version: "3"
services:
rust-gtk-appimage:
build: .
volumes:
- ../adwaita-demo:/mnt:z
command: /bin/bash -c "cargo appimage"