Skip to content

Commit

Permalink
finish from botway cdn assets Dockefile
Browse files Browse the repository at this point in the history
  • Loading branch information
abdfnx committed Jun 6, 2022
1 parent bb8e85a commit b0df521
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 10 deletions.
3 changes: 1 addition & 2 deletions installer/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
[target.x86_64-apple-darwin]
linker = "osxcross/target/bin/x86_64-apple-darwin14-clang"
ar = "x86_64-apple-darwin14-ar"
linker = "x86_64-apple-darwin14-clang"
43 changes: 35 additions & 8 deletions installer/assets/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM rust:alpine
FROM rust:alpine as rs

ENV PACKAGES "build-dependencies xz libxml2-dev build-base openssl cmake openssl-dev musl-dev libressl-dev bsd-compat-headers gcc g++ git lld clang clang-dev patch fts-dev gmp-dev mpfr-dev mpc1-dev perl libsodium ffmpeg opus autoconf automake libtool"
ENV PACKAGES "build-dependencies xz libxml2-dev libpq-dev build-base openssl cmake openssl-dev musl-dev libressl-dev bsd-compat-headers gcc g++ git lld clang clang-dev patch fts-dev gmp-dev mpfr-dev mpc1-dev perl libsodium ffmpeg opus autoconf automake libtool"

RUN apk update && \
apk add --no-cache --virtual ${PACKAGES}
Expand All @@ -17,17 +17,44 @@ RUN cd ./botway/installer && \

# Build macos target
ENV DARWIN_TARGET_PATH="./target/x86_64-apple-darwin/release"
ENV DARWIN_FILE_NAME="rust-std-1.61.0-x86_64-apple-darwin"

RUN wget https://static.rust-lang.org/dist/${DARWIN_FILE_NAME}.tar.gz && \
tar -xvxf ${DARWIN_FILE_NAME}.tar.gz && \
cd ${DARWIN_FILE_NAME} && \
./install.sh

RUN git clone https://github.com/abdfnx/osxcross-alpine osxcross && \
cd osxcross && \
wget -nc https://s3.dockerproject.org/darwin/v2/MacOSX10.10.sdk.tar.xz && \
mv MacOSX10.10.sdk.tar.xz tarballs/ && \
UNATTENDED=yes OSX_VERSION_MIN=10.7 ./build.sh

RUN rustup target add x86_64-apple-darwin
COPY --from=crazymax/osxcross:latest-alpine /osxcross /osxcross
ENV PATH="/osxcross/target/bin:$PATH"
RUN echo $PATH
ENV CC="o64-clang"
ENV CXX="o64-clang++"
ENV LD_LIBRARY_PATH="/osxcross/target/lib:$LD_LIBRARY_PATH"

RUN rustup target add x86_64-apple-darwin

RUN cd ./botway/installer && \
PATH="$(pwd)/osxcross/target/bin:$PATH" \
CC=o64-clang \
CXX=o64-clang++ \
LIBZ_SYS_STATIC=1 \
cargo build --release --target x86_64-apple-darwin && \
cp ${DARWIN_TARGET_PATH}/botway-installer ./installer-macos && \
cp ./installer-macos ./assets/public/installers

RUN ls -a ./botway/installer/assets/public/installers

FROM node:alpine

COPY . .

RUN rm -rf ./botway/installer/assets/public/installers

COPY --from=rs ./botway/installer/assets/public/installers ./botway/installer/assets/public

RUN yarn

EXPOSE 8080

ENTRYPOINT ["yarn", "dev"]

0 comments on commit b0df521

Please sign in to comment.