mirror of
https://github.com/13hannes11/gtk4-rs-docker.git
synced 2024-09-03 23:21:01 +02:00
add image for building appimages
This commit is contained in:
67
.github/workflows/build-push-tagged-appimage.yml
vendored
Normal file
67
.github/workflows/build-push-tagged-appimage.yml
vendored
Normal 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 }}
|
||||||
|
|
||||||
@@ -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
|
||||||
|
|||||||
3
adwaita-demo/.gitignore
vendored
3
adwaita-demo/.gitignore
vendored
@@ -1 +1,4 @@
|
|||||||
/target
|
/target
|
||||||
|
/libs
|
||||||
|
*.AppImage
|
||||||
|
*.png
|
||||||
|
|||||||
@@ -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
30
appimage/Dockerfile
Normal 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"]
|
||||||
7
appimage/docker-compose.yml
Normal file
7
appimage/docker-compose.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
rust-gtk-appimage:
|
||||||
|
build: .
|
||||||
|
volumes:
|
||||||
|
- ../adwaita-demo:/mnt:z
|
||||||
|
command: /bin/bash -c "cargo appimage"
|
||||||
Reference in New Issue
Block a user