yao/docker/build/Dockerfile
Max 6e97de948b Enhance build process and options management
- Update Makefile to include new production and UPX build targets for optimized binaries.
- Add BUILDOPTIONS constant to share/const.go for tracking build configurations.
- Modify version command to display build options.
- Update Dockerfile to install UPX for compression during builds.
- Add release and prod targets to streamline artifact creation.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-03 10:22:55 +08:00

56 lines
No EOL
1.8 KiB
Docker

# ===========================================
# Yao Build Environment (Ubuntu 24.04 AMD64)
#
# Build:
# docker build --platform linux/amd64 -t yaoapp/yao-build:1.0.0 .
#
# Usage:
# docker run --rm -it -v /local/path/dist:/data yaoapp/yao-build:1.0.0
#
# Tests:
# docker run --rm -it yaoapp/yao-build:1.0.0 /bin/bash
# docker run --rm -it -v ./test:/data yaoapp/yao-build:1.0.0 /bin/bash
#
# ===========================================
FROM ubuntu:24.04
WORKDIR /app
ADD build.sh /app/build.sh
ENV PATH=$PATH:/usr/local/go/bin:/root/go/bin
RUN apt-get update && \
apt-get install -y libc6-armel-cross libc6-dev-armel-cross binutils-arm-linux-gnueabi libncurses5-dev build-essential bison flex libssl-dev bc && \
apt-get install -y gcc-arm-linux-gnueabi g++-arm-linux-gnueabi && \
apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf && \
apt-get install -y g++-aarch64-linux-gnu crossbuild-essential-arm64 && \
apt-get install -y gcc-13-aarch64-linux-gnu && \
apt-get install -y g++-13-aarch64-linux-gnu && \
apt-get install -y wget && \
apt-get install -y curl && \
apt-get install -y git && \
apt-get install -y unzip && \
apt-get install -y upx
# Install Go 1.25.0
RUN wget https://golang.org/dl/go1.25.0.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go1.25.0.linux-amd64.tar.gz && \
rm go1.25.0.linux-amd64.tar.gz
# Install Node.js 18.x
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get install -y nodejs
RUN npm install -g pnpm
# Install AWS CLI
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.22.7.zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
./aws/install && \
rm -rf awscliv2.zip && \
rm -rf aws && \
aws --version
# RUN npm install -g pnpm
RUN chmod +x /app/build.sh
VOLUME [ "/data" ]
CMD ["/app/build.sh"]