Skip to content

Commit

Permalink
fix lapce-proxy build (lapce#3379)
Browse files Browse the repository at this point in the history
  • Loading branch information
panekj authored Jul 21, 2024
1 parent bd2cfc5 commit a6c21dc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 35 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,14 @@ jobs:
matrix:
include:
- os-name: alpine
os-version: '3.20'
os-version: '3-20'
steps:
- uses: actions/checkout@v4

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

- name: Build lapce-proxy binary
run: |
docker buildx create --driver=docker-container --use
docker buildx bake --pull ${{ matrix.os-name }}-${{ matrix.os-version }}
Expand Down
3 changes: 2 additions & 1 deletion docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
variable "RUST_VERSION" {
default = "1.76"
default = "1"
}

variable "XX_VERSION" {
Expand Down Expand Up @@ -195,6 +195,7 @@ variable "APK_FAMILY_PACKAGES" {
"lld",
"build-base",
"rustup",
"openssl-dev",
"openssl-libs-static",
"libssh2-static",
"libgit2-static",
Expand Down
44 changes: 12 additions & 32 deletions extra/linux/docker/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ SHELL [ "/bin/ash", "-c" ]
# install host dependencies
ARG DISTRIBUTION_PACKAGES
RUN \
--mount=type=cache,target=/var/cache/apt,sharing=private \
--mount=type=cache,target=/var/lib/apt,sharing=private \
--mount=type=cache,target=/var/cache/apk,sharing=private \
--mount=type=cache,target=/etc/apk/cache,sharing=private \
<<EOF

apk upgrade -Ua
apk add --no-cache \
bash clang lld llvm file git sccache \
cmake pkgconf build-base abuild curl \
cmake pkgconf build-base abuild curl mold \
${DISTRIBUTION_PACKAGES}
EOF

Expand Down Expand Up @@ -48,8 +48,8 @@ EOF
ARG TARGETPLATFORM
ARG DISTRIBUTION_PACKAGES
RUN \
--mount=type=cache,target=/var/cache/apt,sharing=private \
--mount=type=cache,target=/var/lib/apt,sharing=private \
--mount=type=cache,target=/var/cache/apk,sharing=private \
--mount=type=cache,target=/etc/apk/cache,sharing=private \
<<EOF
#!/usr/bin/env bash
set -euxo pipefail
Expand Down Expand Up @@ -98,46 +98,26 @@ export OPENSSL_STATIC="1"
export PKG_CONFIG_ALL_STATIC="1"
export OPENSSL_NO_VENDOR="1"
export ZSTD_SYS_USE_PKG_CONFIG="1"
export RUSTFLAGS="-C linker=clang -C link-arg=-fuse-ld=lld -C target-feature=+crt-static"
export RUSTFLAGS="-C linker=clang -C link-arg=-fuse-ld=mold -C target-feature=+crt-static"
export PKG_CONFIG="$(xx-clang --print-prog-name=pkg-config)"

xx-cargo build \
--verbose \
--frozen \
--package lapce-app \
--bin lapce-proxy \
--profile release-lto \
--no-default-features

export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+crt-static"
--no-default-features

xx-cargo build

xx-verify "${CARGO_TARGET_DIR}"/"$(xx-cargo --print-target-triple)"/release-lto/lapce
xx-verify "${CARGO_TARGET_DIR}"/"$(xx-cargo --print-target-triple)"/release-lto/lapce-proxy

mkdir -p /target
mv -v "${CARGO_TARGET_DIR}"/"$(xx-cargo --print-target-triple)"/release-lto/lapce /target/

cargo pkgid | cut -d'#' -f2 | cut -d'@' -f2 | cut -d':' -f2 | tee /target/lapce.version
EOF

WORKDIR /output
RUN <<EOF
#!/usr/bin/env bash
set -euxo pipefail

echo 'a'
mv -v "${CARGO_TARGET_DIR}"/"$(xx-cargo --print-target-triple)"/release-lto/lapce-proxy /usr/local/bin/
EOF

FROM build-prep AS dev

FROM scratch AS binary
COPY --from=build /output/lapce .
COPY --from=build /usr/local/bin/lapce-proxy .

FROM scratch AS cross-binary
COPY --from=build /output/lapce .

# FROM scratch AS package
# COPY --from=build /output/*.deb .

# FROM scratch AS cross-package
# COPY --from=build /output/*.deb .
COPY --from=build /usr/local/bin/lapce-proxy .

0 comments on commit a6c21dc

Please sign in to comment.