Skip to content

Commit

Permalink
add Dockerfile (based on Alpine)
Browse files Browse the repository at this point in the history
  • Loading branch information
phil294 committed Jul 21, 2023
1 parent 3b76b3d commit c640e44
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 7 deletions.
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,14 @@
*.dwarf
todo*
AutoHotkey*.chm
.vscode/.history
.vscode/.history

build/libxdo.so*
build/libxkbcommon.so*
build/libxkbcustom.a
build/linuxdeploy-x86_64.AppImage
build/linuxdeploy-plugin-gtk.sh
build/*.AppImage*

# for generating a .dockerignore based on .gitignore:
.git
6 changes: 0 additions & 6 deletions build/.gitignore

This file was deleted.

10 changes: 10 additions & 0 deletions build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ The released binaries are special because they need to be portable. We achieve t
There's a script to call `./build.sh`, make a new release and publish it etc., it's `../release.sh`. You most likely can't run it yourself though.
### Docker
In the rare case that you want to use ahk_x11 containerized for headless purposes, you can find a working Dockerfile example in `./ahk_x11.alpine.Dockerfile`. Run it in the parent (main) directory like so:
```bash
cp .gitignore .dockerignore && \
docker build -t ahk_x11-alpine -f build/ahk_x11.alpine.Dockerfile . ; \
rm .dockerignore
```

## Contributing

If you feel like it, you are welcome to contribute! The language in use, Crystal, is resembling Ruby syntax and consequently also great for beginners.
Expand Down
22 changes: 22 additions & 0 deletions build/ahk_x11.alpine.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM alpine:latest as build-xdotool
RUN apk add --no-cache alpine-sdk libxtst-dev libxinerama-dev libxkbcommon-dev libx11-dev
RUN git clone --depth=1 https://github.com/jordansissel/xdotool /xdo
WORKDIR /xdo
RUN make WITHOUT_RPATH_FIX=1 libxdo.a

FROM crystallang/crystal:latest-alpine AS build-ahkx11
RUN apk add --no-cache gtk+3.0-dev gobject-introspection-dev libxtst-dev libnotify-dev
RUN git clone --depth=1 https://github.com/phil294/ahk_x11 /ahk
WORKDIR /ahk
RUN shards install
RUN bin/gi-crystal
RUN sed -i -E 's/private getter xdo_p/getter xdo_p/' lib/x_do/src/x_do.cr
RUN sed -i -E 's/GLib::String/::String/g' lib/gi-crystal/src/auto/gtk-3.0/gtk.cr
RUN mkdir static
COPY --from=build-xdotool /xdo/libxdo.a static
RUN shards build -Dpreview_mt --link-flags="-L$PWD/static -lxdo -lxkbcommon -lXinerama -lXtst -lXi -lX11" --release

FROM alpine:latest
RUN apk add --no-cache libx11 libnotify gtk+3.0 libgcc
COPY --from=build-ahkx11 /ahk/bin/ahk_x11 .
CMD ["./ahk_x11"]

0 comments on commit c640e44

Please sign in to comment.