Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to bullseye base image #2

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/build-linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ jobs:
with:
fetch-depth: 1

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand Down
45 changes: 30 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@
# Adopted from Go Releaser Toolchain
# https://github.com/goreleaser/goreleaser-cross-toolchains/blob/main/Dockerfile

ARG GO_VERSION=1.21.1

FROM --platform=$BUILDPLATFORM golang:${GO_VERSION} as builder
FROM --platform=$BUILDPLATFORM debian:bullseye as builder

LABEL maintainer="Ibrahim Najjar <https://github.com/abjrcode/>"
LABEL "org.opencontainers.image.source"="https://github.com/abjrcode/cross-wails"
Expand All @@ -35,19 +34,24 @@ LABEL "org.opencontainers.image.source"="https://github.com/abjrcode/cross-wails
ARG TARGETARCH

ENV DEBIAN_FRONTEND=noninteractive
ARG DPKG_ARCH="amd64 arm64 i386"
ARG DPKG_ARCH="amd64 arm64"
ARG CROSSBUILD_ARCH="amd64 arm64"
ARG MINGW_VERSION=20230130
ARG MINGW_HOST="ubuntu-22.04"
ARG MINGW_HOST="ubuntu-18.04"

SHELL ["/bin/bash", "-c"]

RUN set -x; \
while read arch; do dpkg --add-architecture $arch; done < <(echo "${DPKG_ARCH}" | tr ' ' '\n') \
apt-get update \
&& apt-get install --no-install-recommends -y -qq \
wget \
ca-certificates \
gnupg \
nsis \
&& while read arch; do dpkg --add-architecture $arch; done < <(echo "${DPKG_ARCH}" | tr ' ' '\n') \
&& crossbuild_pkgs=$(while read arch; do echo -n "crossbuild-essential-$arch "; done < <(echo "${CROSSBUILD_ARCH}" | tr ' ' '\n')) \
&& apt-get update \
&& apt-get install --no-install-recommends -y -q \
libc6-dev \
&& apt-get install --no-install-recommends -y -qq \
gcc \
libarchive-tools \
mingw-w64 \
Expand All @@ -65,18 +69,23 @@ RUN dpkg --add-architecture arm64 \
&& apt-get -qq update \
&& apt-get -qq install -y libgtk-3-dev:arm64 libwebkit2gtk-4.0-dev:arm64

# NSIS is only needed for Windows, so we install the one that matches the build platform
RUN apt-get -qq install -y nsis

ARG NODE_MAJOR_VERSION=18

# Install NodeJS
RUN apt-get -qq install -y ca-certificates curl gnupg && \
mkdir -p /etc/apt/keyrings && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
RUN mkdir -p /etc/apt/keyrings && \
wget -q -O - https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR_VERSION.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
apt-get -qq update && apt-get -qq install nodejs -y


# Install Go
ARG GO_VERSION=1.21.3
RUN wget https://go.dev/dl/go${GO_VERSION}.linux-${TARGETARCH}.tar.gz \
&& rm -rf /usr/local/go && tar -C /usr/local -xzf go${GO_VERSION}.linux-${TARGETARCH}.tar.gz \
&& rm go${GO_VERSION}.linux-${TARGETARCH}.tar.gz

ENV PATH=$PATH:/root/go/bin:/usr/local/go/bin

RUN apt -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
Expand All @@ -85,10 +94,16 @@ RUN apt -y autoremove \
&& rm -rf /usr/share/man/* \
/usr/share/doc

ENV CGO_ENABLED=1

# Install Wails
ARG WAILS_VERSION=v2.6.0
RUN go install github.com/wailsapp/wails/v2/cmd/wails@${WAILS_VERSION}
RUN if [ "${TARGETARCH}" = "amd64" ]; then \
CC="x86_64-linux-gnu-gcc"; \
else \
CC="aarch64-linux-gnu-gcc"; \
fi; \
GOARCH=${TARGETARCH} CC=${CC} go install github.com/wailsapp/wails/v2/cmd/wails@${WAILS_VERSION}

ENV CGO_ENABLED=1

ENTRYPOINT [ "/bin/bash" ]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Cross Wails

Docker Image for Cross Compiling Wails Applications
Docker Image for Cross Compiling [Wails Applications](https://wails.io/)

## Usage

```dockerfile
FROM ghcr.io/abjrcode/wails-cross:latest
FROM ghcr.io/abjrcode/wails-cross:v2.6.0
```

## Details
Expand Down