File size: 1,272 Bytes
76fbabe
0c8cbd4
76fbabe
 
0c8cbd4
 
76fbabe
0c8cbd4
 
b95799c
0c8cbd4
b95799c
0c8cbd4
 
 
76fbabe
a11686a
0c8cbd4
76fbabe
0c8cbd4
76fbabe
 
0c8cbd4
 
 
 
 
76fbabe
0c8cbd4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Start with the Debian Bullseye Slim image
FROM debian:bullseye-slim

# Update package files and install Curl
RUN apt-get update && apt-get install -y curl

# Download the latest version of Ninja from GitHub
RUN version=$(basename $(curl -sL -o /dev/null -w %{url_effective} https://github.com/gngpp/ninja/releases/latest)) \
    && base_url="https://github.com/gngpp/ninja/releases/expanded_assets/$version" \
    # Get the URL of the distribution based on x86_64 CPU and musl libc
    && latest_url=https://github.com/$(curl -sL $base_url | grep -oP 'href=".*x86_64.*musl\.tar\.gz(?=")' | sed 's/href="//') \
    # Download the tar.gz file and extract it
    && curl -Lo ninja.tar.gz $latest_url \
    && tar -xzf ninja.tar.gz

# Set the Chinese language environment and do not interact with APT
ENV LANG=C.UTF-8 DEBIAN_FRONTEND=noninteractive LANG=en-US.UTF-8 LANGUAGE=en-US.UTF-8 LC_ALL=C

# Copy the main `ninja` file to /bin so it can be run from anywhere
RUN cp ninja /bin/ninja

# Create necessary folders and set access rights
RUN mkdir /.gpt3 && chmod 777 /.gpt3
RUN mkdir /.gpt4 && chmod 777 /.gpt4
RUN mkdir /.auth && chmod 777 /.auth
RUN mkdir /.platform && chmod 777 /.platform

# By default when running an image, it will run ninja
CMD ["/bin/ninja","run"]