Browse Source

Updates...

master
Kenneth Bruen 3 years ago
parent
commit
36b1662945
Signed by: kbruen
GPG Key ID: C1980A470C3EE5B1
  1. 3
      .gitignore
  2. 17
      .vscode/launch.json
  3. 7
      .vscode/settings.json
  4. 15
      alpine/Dockerfile
  5. 26
      alpine/Dockerfile-low-ram
  6. 10
      alpine/Dockerfile-so
  7. 113
      alpine/build.sh
  8. 203
      build-all.rb
  9. 15
      debian/Dockerfile
  10. 27
      debian/Dockerfile-low-ram
  11. 10
      debian/Dockerfile-so
  12. 111
      debian/build.sh
  13. 15
      ubuntu/Dockerfile
  14. 27
      ubuntu/Dockerfile-low-ram
  15. 10
      ubuntu/Dockerfile-so
  16. 111
      ubuntu/build.sh

3
.gitignore vendored

@ -1 +1,2 @@
workspace.code-workspace
workspace.code-workspace
samples

17
.vscode/launch.json vendored

@ -0,0 +1,17 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"cwd": "${workspaceRoot}",
"name": "Listen for rdebug-ide",
"type": "Ruby",
"request": "attach",
"remoteHost": "127.0.0.1",
"remotePort": "1234",
"remoteWorkspaceRoot": "${workspaceRoot}"
},
]
}

7
.vscode/settings.json vendored

@ -0,0 +1,7 @@
{
"files.exclude": {
"alpine": true,
"debian": true,
"ubuntu": true
}
}

15
alpine/Dockerfile

@ -3,18 +3,17 @@ FROM alpine:${ALPINE_VERSION} AS builder
WORKDIR /tdlib
RUN apk update && apk upgrade && apk add --update alpine-sdk linux-headers git zlib-dev openssl-dev gperf php cmake
RUN git clone https://github.com/tdlib/td.git .
ARG TDLIB_VER
RUN git checkout "tags/v${TDLIB_VER}"
ARG TDLIB_TAG
ARG TDLIB_COMMIT
RUN if [ "$TDLIB_TAG" ]; then \
git checkout "tags/${TDLIB_TAG}"; \
else \
git checkout "${TDLIB_COMMIT}"; \
fi
RUN rm -rf build && mkdir build
WORKDIR /tdlib/build
RUN cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=../tdlib ..
RUN cmake --build . --target prepare_cross_compiling
WORKDIR /tdlib
RUN php SplitSource.php
WORKDIR /tdlib/build
RUN cmake --build . --target install
WORKDIR /tdlib
RUN php SplitSource.php --undo
FROM alpine:${ALPINE_VERSION}
WORKDIR /tdlib

26
alpine/Dockerfile-low-ram

@ -0,0 +1,26 @@
ARG ALPINE_VERSION
FROM alpine:${ALPINE_VERSION} AS builder
WORKDIR /tdlib
RUN apk update && apk upgrade && apk add --update alpine-sdk linux-headers git zlib-dev openssl-dev gperf php cmake
RUN git clone https://github.com/tdlib/td.git .
ARG TDLIB_TAG
ARG TDLIB_COMMIT
RUN if [ "$TDLIB_TAG" ]; then \
git checkout "tags/${TDLIB_TAG}"; \
else \
git checkout "${TDLIB_COMMIT}"; \
fi
RUN rm -rf build && mkdir build
WORKDIR /tdlib/build
RUN cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=../tdlib ..
RUN cmake --build . --target prepare_cross_compiling
WORKDIR /tdlib
RUN php SplitSource.php
WORKDIR /tdlib/build
RUN cmake --build . --target install
WORKDIR /tdlib
RUN php SplitSource.php --undo
FROM alpine:${ALPINE_VERSION}
WORKDIR /tdlib
COPY --from=builder /tdlib/tdlib /tdlib

10
alpine/Dockerfile-so

@ -0,0 +1,10 @@
ARG ALPINE_VERSION
ARG TDLIB_IMAGE
FROM ${TDLIB_IMAGE} AS tdlib
RUN mkdir /tdlib-so
WORKDIR /tdlib-so
RUN find /tdlib/lib -regex '.*\.so.*' -print0 | xargs -0 -I % cp -P % .
FROM alpine:${ALPINE_VERSION}
WORKDIR /tdlib-so
COPY --from=tdlib /tdlib-so .

113
alpine/build.sh

@ -1,16 +1,117 @@
#! /usr/bin/env sh
if [ -z $ALPINE_VERSION ]
# Parse arguments
help () {
echo 'build.sh -- Alpine image'
echo
echo ' -v --alpine $ALPINE_VERSION:'
echo ' specify version of Alpine Docker image'
echo ' -t --tag $TDLIB_TAG:'
echo ' specify the tdlib repository tag'
echo ' -c --commit $TDLIB_COMMIT:'
echo ' specify the tdlib repository commit hash'
exit 0
}
unknown_param () {
echo 'build.sh: Unknown parameter $1'
exit 1
}
while [ $# -gt 0 ]
do
param="$1"
shift
case "$param" in
"-v")
;&
"--alpine")
export ALPINE_VERSION=$1
echo "ALPINE_VERSION=$ALPINE_VERSION"
shift
;;
"-h")
;&
"--help")
help
;;
"-t")
;&
"--tag")
export TDLIB_TAG=$1
echo "TDLIB_TAG=$TDLIB_TAG"
shift
;;
"-c")
;&
"--commit")
export TDLIB_COMMIT=$1
echo "TDLIB_COMMIT=$TDLIB_COMMIT"
shift
;;
*)
unknown_param "$param"
;;
esac
done
if [ -z "$ALPINE_VERSION" ]
then
echo "Please specify a version by setting the ALPINE_VERSION env var"
echo "build.sh: Please specify a version using -v"
exit 1
fi
if [ $# -eq 1 ]
ram=$(free -m | grep -oP '\d+' | head -n 1)
if [ $ram -lt 3584 ] # 3.5 GB RAM = 3584 MB
then
dockerfile=Dockerfile-low-ram
else
dockerfile=Dockerfile
fi
if [ "$TDLIB_TAG" ]
then
export TDLIB_VER="$1"
if [ -z "$IMAGE_TAG" ]
then
export IMAGE_TAG="tdlib:$TDLIB_TAG-alpine-$ALPINE_VERSION"
echo "IMAGE_TAG=$IMAGE_TAG"
fi
docker build \
-t "$IMAGE_TAG" \
--build-arg TDLIB_TAG \
--build-arg ALPINE_VERSION \
-f $dockerfile \
$(dirname $0)
elif [ "$TDLIB_COMMIT" ]
then
if [ -z "$IMAGE_TAG" ]
then
export IMAGE_TAG="tdlib:$TDLIB_COMMIT-alpine-$ALPINE_VERSION"
echo "IMAGE_TAG=$IMAGE_TAG"
fi
docker build \
-t "$IMAGE_TAG" \
--build-arg TDLIB_COMMIT \
--build-arg ALPINE_VERSION \
-f $dockerfile \
$(dirname $0)
else
export TDLIB_VER="1.7.0"
echo 'build.sh: no commit or tag supplied'
echo ' TIP: Find tags here: https://github.com/tdlib/td/tags'
echo ' TIP: Find commits here: https://github.com/tdlib/td/commits/master'
exit 1
fi
docker build -t "tdlib:$TDLIB_VER-alpine-$ALPINE_VERSION" --build-arg TDLIB_VER --build-arg ALPINE_VERSION $(dirname $0)
if [ -z $SO_IMAGE_TAG ]
then
export SO_IMAGE_TAG="$IMAGE_TAG-so"
fi
echo "SO_IMAGE_TAG=$SO_IMAGE_TAG"
docker build \
-t "$SO_IMAGE_TAG" \
--build-arg "TDLIB_IMAGE=$IMAGE_TAG" \
--build-arg ALPINE_VERSION \
-f Dockerfile-so \
.

203
build-all.rb

@ -0,0 +1,203 @@
#! /usr/bin/env ruby
os_versions = {
alpine: [],
debian: [],
ubuntu: [],
}
tdlib_versions = []
image_names = []
puts 'Alpine versions? (end with empty line)'
loop do
line = gets
if line.nil?
break
end
version, *aliases = line.strip.split('|')
if version.nil?
break
end
if aliases.empty?
aliases.append "alpine-#{version}"
end
os_versions[:alpine].append({
version: version,
aliases: aliases,
})
end
puts 'Debian versions? (end with empty line)'
loop do
line = gets
if line.nil?
break
end
version, *aliases = line.strip.split('|')
if version.nil?
break
end
if aliases.empty?
aliases.append "debian-#{version}"
end
os_versions[:debian].append({
version: version,
aliases: aliases,
})
end
puts 'Ubuntu versions? (end with empty line)'
loop do
line = gets
if line.nil?
break
end
version, *aliases = line.strip.split('|')
if version.nil?
break
end
if aliases.empty?
aliases.append "ubuntu-#{version}"
end
os_versions[:ubuntu].append({
version: version,
aliases: aliases,
})
end
puts 'tdlib commits? (end with empty line; tag:XXX to insert tag name)'
loop do
line = gets
if line.nil?
break
end
commit, *aliases = line.strip.split('|')
if commit.nil?
break
end
if commit.start_with? 'tag:'
tag = commit[4..]
commit = nil
end
if aliases.empty?
if commit.nil?
aliases.append tag
else
aliases.append commit
end
end
tdlib_versions.append({
tag: tag,
commit: commit,
aliases: aliases,
})
end
puts 'Image names? (end with empty line)'
loop do
line = gets
if line.nil?
break
end
image_names.append(line.strip)
end
if image_names.empty?
image_names.append "tdlib"
end
def get_script os
case os
when :alpine
'./alpine/build.sh'
when :debian
'./debian/build.sh'
when :ubuntu
'./ubuntu/build.sh'
else
fail "Unknown OS: #{os}"
end
end
def get_tdlib_ver_print tdlib_ver
if not tdlib_ver[:tag].nil?
"tags/#{tdlib_ver[:tag]}"
else
tdlib_ver[:commit]
end
end
failures = 0
os_versions.each_pair do |os, os_versions|
script = get_script os
os_versions.each do |os_version|
tdlib_versions.each do |tdlib_version|
puts "\x1b[94mNow building \x1b[92m#{os}:#{os_version[:version]}\x1b[94m, TDLIB: \x1b[92m#{get_tdlib_ver_print(tdlib_version)}\x1b[39m"
if not tdlib_version[:tag].nil?
success = system(
{"IMAGE_TAG" => "tdlib:ruby_temp_img", "SO_IMAGE_TAG" => "tdlib:ruby_temp_img_so"},
"./#{File.basename("./build.sh")}",
"-v",
os_version[:version],
"-t",
tdlib_version[:tag],
chdir: File.dirname(File.realpath(script)),
exception: true,
)
else
success = system(
{"IMAGE_TAG" => "tdlib:ruby_temp_img", "SO_IMAGE_TAG" => "tdlib:ruby_temp_img_so"},
"./#{File.basename("./build.sh")}",
"-v",
os_version[:version],
"-c",
tdlib_version[:commit],
chdir: File.dirname(File.realpath(script)),
exception: true,
)
end
if success
puts "Image build, tagging..."
image_names.each do |img_name|
os_version[:aliases].each do |os_alias|
tdlib_version[:aliases].each do |tdlib_alias|
tag = "#{img_name}:#{tdlib_alias}-#{os_alias}"
system(
"docker",
"tag",
"tdlib:ruby_temp_img",
tag
)
puts "\x1b[37m- \x1b[92m#{tag}\x1b[39m"
end
end
end
image_names.each do |img_name|
os_version[:aliases].each do |os_alias|
tdlib_version[:aliases].each do |tdlib_alias|
tag = "#{img_name}:so-#{tdlib_alias}-#{os_alias}"
system(
"docker",
"tag",
"tdlib:ruby_temp_img_so",
tag
)
puts "\x1b[37m- \x1b[92m#{tag}\x1b[39m"
end
end
end
system("docker", "image", "rm", "tdlib:ruby_temp_img")
system("docker", "image", "rm", "tdlib:ruby_temp_img_so")
else
$stderr.puts "Failed!"
failures += 1
end
end
end
end
if failures != 0
exit 1
end

15
debian/Dockerfile vendored

@ -4,18 +4,17 @@ WORKDIR /tdlib
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get -y update && apt-get -y upgrade && apt-get -y install make git zlib1g-dev libssl-dev gperf php-cli cmake clang libc++-dev libc++abi-dev
RUN git clone https://github.com/tdlib/td.git .
ARG TDLIB_VER
RUN git checkout "tags/v${TDLIB_VER}"
ARG TDLIB_TAG
ARG TDLIB_COMMIT
RUN if [ "$TDLIB_TAG" ]; then \
git checkout "tags/${TDLIB_TAG}"; \
else \
git checkout "${TDLIB_COMMIT}"; \
fi
RUN rm -rf build && mkdir build
WORKDIR /tdlib/build
RUN CXXFLAGS="-stdlib=libc++" CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=../tdlib ..
RUN cmake --build . --target prepare_cross_compiling
WORKDIR /tdlib
RUN php SplitSource.php
WORKDIR /tdlib/build
RUN cmake --build . --target install
WORKDIR /tdlib
RUN php SplitSource.php --undo
FROM debian:${DEBIAN_VERSION}
WORKDIR /tdlib

27
debian/Dockerfile-low-ram vendored

@ -0,0 +1,27 @@
ARG DEBIAN_VERSION
FROM debian:${DEBIAN_VERSION} AS builder
WORKDIR /tdlib
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get -y update && apt-get -y upgrade && apt-get -y install make git zlib1g-dev libssl-dev gperf php-cli cmake clang libc++-dev libc++abi-dev
RUN git clone https://github.com/tdlib/td.git .
ARG TDLIB_TAG
ARG TDLIB_COMMIT
RUN if [ "$TDLIB_TAG" ]; then \
git checkout "tags/${TDLIB_TAG}"; \
else \
git checkout "${TDLIB_COMMIT}"; \
fi
RUN rm -rf build && mkdir build
WORKDIR /tdlib/build
RUN CXXFLAGS="-stdlib=libc++" CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=../tdlib ..
RUN cmake --build . --target prepare_cross_compiling
WORKDIR /tdlib
RUN php SplitSource.php
WORKDIR /tdlib/build
RUN cmake --build . --target install
WORKDIR /tdlib
RUN php SplitSource.php --undo
FROM debian:${DEBIAN_VERSION}
WORKDIR /tdlib
COPY --from=builder /tdlib/tdlib /tdlib

10
debian/Dockerfile-so vendored

@ -0,0 +1,10 @@
ARG DEBIAN_VERSION
ARG TDLIB_IMAGE
FROM ${TDLIB_IMAGE} AS tdlib
RUN mkdir /tdlib-so
WORKDIR /tdlib-so
RUN find /tdlib/lib -regex '.*\.so.*' -print0 | xargs -0 -I % cp -P % .
FROM debian:${DEBIAN_VERSION}
WORKDIR /tdlib-so
COPY --from=tdlib /tdlib-so .

111
debian/build.sh vendored

@ -1,16 +1,117 @@
#! /usr/bin/env sh
# Parse arguments
help () {
echo 'build.sh -- Ubuntu image'
echo
echo ' -v --debian $DEBIAN_VERSION:'
echo ' specify version of Debian Docker image'
echo ' -t --tag $TDLIB_TAG:'
echo ' specify the tdlib repository tag'
echo ' -c --commit $TDLIB_COMMIT:'
echo ' specify the tdlib repository commit hash'
exit 0
}
unknown_param () {
echo 'build.sh: Unknown parameter $1'
exit 1
}
while [ $# -gt 0 ]
do
param="$1"
shift
case "$param" in
"-v")
;&
"--debian")
export DEBIAN_VERSION=$1
echo "DEBIAN_VERSION=$DEBIAN_VERSION"
shift
;;
"-h")
;&
"--help")
help
;;
"-t")
;&
"--tag")
export TDLIB_TAG=$1
echo "TDLIB_TAG=$TDLIB_TAG"
shift
;;
"-c")
;&
"--commit")
export TDLIB_COMMIT=$1
echo "TDLIB_COMMIT=$TDLIB_COMMIT"
shift
;;
*)
unknown_param "$param"
;;
esac
done
if [ -z $DEBIAN_VERSION ]
then
echo "Please specify a version by setting the DEBIAN_VERSION env var"
echo "build.sh: Please specify a version using -v"
exit 1
fi
if [ $# -eq 1 ]
ram=$(free -m | grep -oP '\d+' | head -n 1)
if [ $ram -lt 3584 ] # 3.5 GB RAM = 3584 MB
then
dockerfile=Dockerfile-low-ram
else
dockerfile=Dockerfile
fi
if [ "$TDLIB_TAG" ]
then
export TDLIB_VER="$1"
if [ -z "$IMAGE_TAG" ]
then
export IMAGE_TAG="tdlib:$TDLIB_TAG-$DEBIAN_VERSION"
echo "IMAGE_TAG=$IMAGE_TAG"
fi
docker build \
-t "$IMAGE_TAG" \
--build-arg TDLIB_TAG \
--build-arg DEBIAN_VERSION \
-f $dockerfile \
$(dirname $0)
elif [ "$TDLIB_COMMIT" ]
then
if [ -z "$IMAGE_TAG" ]
then
export IMAGE_TAG="tdlib:$TDLIB_COMMIT-$DEBIAN_VERSION"
echo "IMAGE_TAG=$IMAGE_TAG"
fi
docker build \
-t "$IMAGE_TAG" \
--build-arg TDLIB_COMMIT \
--build-arg DEBIAN_VERSION \
-f $dockerfile \
$(dirname $0)
else
export TDLIB_VER="1.7.0"
echo 'build.sh: no commit or tag supplied'
echo ' TIP: Find tags here: https://github.com/tdlib/td/tags'
echo ' TIP: Find commits here: https://github.com/tdlib/td/commits/master'
exit 1
fi
docker build -t "tdlib:$TDLIB_VER-$DEBIAN_VERSION" --build-arg TDLIB_VER --build-arg DEBIAN_VERSION $(dirname $0)
if [ -z $SO_IMAGE_TAG ]
then
export SO_IMAGE_TAG="$IMAGE_TAG-so"
fi
echo "SO_IMAGE_TAG=$SO_IMAGE_TAG"
docker build \
-t "$SO_IMAGE_TAG" \
--build-arg "TDLIB_IMAGE=$IMAGE_TAG" \
--build-arg DEBIAN_VERSION \
-f Dockerfile-so \
.

15
ubuntu/Dockerfile

@ -4,18 +4,17 @@ WORKDIR /tdlib
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get -y update && apt-get -y upgrade && apt-get -y install make git zlib1g-dev libssl-dev gperf php-cli cmake clang-10 libc++-dev libc++abi-dev
RUN git clone https://github.com/tdlib/td.git .
ARG TDLIB_VER
RUN git checkout "tags/v${TDLIB_VER}"
ARG TDLIB_TAG
ARG TDLIB_COMMIT
RUN if [ "$TDLIB_TAG" ]; then \
git checkout "tags/${TDLIB_TAG}"; \
else \
git checkout "${TDLIB_COMMIT}"; \
fi
RUN rm -rf build && mkdir build
WORKDIR /tdlib/build
RUN CXXFLAGS="-stdlib=libc++" CC=/usr/bin/clang-10 CXX=/usr/bin/clang++-10 cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=../tdlib -DTD_ENABLE_LTO=ON -DCMAKE_AR=/usr/bin/llvm-ar-10 -DCMAKE_NM=/usr/bin/llvm-nm-10 -DCMAKE_OBJDUMP=/usr/bin/llvm-objdump-10 -DCMAKE_RANLIB=/usr/bin/llvm-ranlib-10 ..
RUN cmake --build . --target prepare_cross_compiling
WORKDIR /tdlib
RUN php SplitSource.php
WORKDIR /tdlib/build
RUN cmake --build . --target install
WORKDIR /tdlib
RUN php SplitSource.php --undo
FROM ubuntu:${UBUNTU_VERSION}
WORKDIR /tdlib

27
ubuntu/Dockerfile-low-ram

@ -0,0 +1,27 @@
ARG UBUNTU_VERSION
FROM ubuntu:${UBUNTU_VERSION} AS builder
WORKDIR /tdlib
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get -y update && apt-get -y upgrade && apt-get -y install make git zlib1g-dev libssl-dev gperf php-cli cmake clang-10 libc++-dev libc++abi-dev
RUN git clone https://github.com/tdlib/td.git .
ARG TDLIB_TAG
ARG TDLIB_COMMIT
RUN if [ "$TDLIB_TAG" ]; then \
git checkout "tags/${TDLIB_TAG}"; \
else \
git checkout "${TDLIB_COMMIT}"; \
fi
RUN rm -rf build && mkdir build
WORKDIR /tdlib/build
RUN CXXFLAGS="-stdlib=libc++" CC=/usr/bin/clang-10 CXX=/usr/bin/clang++-10 cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=../tdlib -DTD_ENABLE_LTO=ON -DCMAKE_AR=/usr/bin/llvm-ar-10 -DCMAKE_NM=/usr/bin/llvm-nm-10 -DCMAKE_OBJDUMP=/usr/bin/llvm-objdump-10 -DCMAKE_RANLIB=/usr/bin/llvm-ranlib-10 ..
RUN cmake --build . --target prepare_cross_compiling
WORKDIR /tdlib
RUN php SplitSource.php
WORKDIR /tdlib/build
RUN cmake --build . --target install
WORKDIR /tdlib
RUN php SplitSource.php --undo
FROM ubuntu:${UBUNTU_VERSION}
WORKDIR /tdlib
COPY --from=builder /tdlib/tdlib /tdlib

10
ubuntu/Dockerfile-so

@ -0,0 +1,10 @@
ARG UBUNTU_VERSION
ARG TDLIB_IMAGE
FROM ${TDLIB_IMAGE} AS tdlib
RUN mkdir /tdlib-so
WORKDIR /tdlib-so
RUN find /tdlib/lib -regex '.*\.so.*' -print0 | xargs -0 -I % cp -P % .
FROM ubuntu:${UBUNTU_VERSION}
WORKDIR /tdlib-so
COPY --from=tdlib /tdlib-so .

111
ubuntu/build.sh

@ -1,16 +1,117 @@
#! /usr/bin/env sh
# Parse arguments
help () {
echo 'build.sh -- Ubuntu image'
echo
echo ' -v --ubuntu $UBUNTU_VERSION:'
echo ' specify version of Ubuntu Docker image'
echo ' -t --tag $TDLIB_TAG:'
echo ' specify the tdlib repository tag'
echo ' -c --commit $TDLIB_COMMIT:'
echo ' specify the tdlib repository commit hash'
exit 0
}
unknown_param () {
echo 'build.sh: Unknown parameter $1'
exit 1
}
while [ $# -gt 0 ]
do
param="$1"
shift
case "$param" in
"-v")
;&
"--ubuntu")
export UBUNTU_VERSION=$1
echo "UBUNTU_VERSION=$UBUNTU_VERSION"
shift
;;
"-h")
;&
"--help")
help
;;
"-t")
;&
"--tag")
export TDLIB_TAG=$1
echo "TDLIB_TAG=$TDLIB_TAG"
shift
;;
"-c")
;&
"--commit")
export TDLIB_COMMIT=$1
echo "TDLIB_COMMIT=$TDLIB_COMMIT"
shift
;;
*)
unknown_param "$param"
;;
esac
done
if [ -z $UBUNTU_VERSION ]
then
echo "Please specify a version by setting the UBUNTU_VERSION env var"
echo "build.sh: Please specify a version using -v"
exit 1
fi
if [ $# -eq 1 ]
ram=$(free -m | grep -oP '\d+' | head -n 1)
if [ $ram -lt 3584 ] # 3.5 GB RAM = 3584 MB
then
dockerfile=Dockerfile-low-ram
else
dockerfile=Dockerfile
fi
if [ "$TDLIB_TAG" ]
then
export TDLIB_VER="$1"
if [ -z "$IMAGE_TAG" ]
then
export IMAGE_TAG="tdlib:$TDLIB_TAG-$UBUNTU_VERSION"
fi
echo "IMAGE_TAG=$IMAGE_TAG"
docker build \
-t "$IMAGE_TAG" \
--build-arg TDLIB_TAG \
--build-arg UBUNTU_VERSION \
-f $dockerfile \
$(dirname $0)
elif [ "$TDLIB_COMMIT" ]
then
if [ -z "$IMAGE_TAG" ]
then
export IMAGE_TAG="tdlib:$TDLIB_COMMIT-$UBUNTU_VERSION"
fi
echo "IMAGE_TAG=$IMAGE_TAG"
docker build \
-t "$IMAGE_TAG" \
--build-arg TDLIB_COMMIT \
--build-arg UBUNTU_VERSION \
-f $dockerfile \
$(dirname $0)
else
export TDLIB_VER="1.7.0"
echo 'build.sh: no commit or tag supplied'
echo ' TIP: Find tags here: https://github.com/tdlib/td/tags'
echo ' TIP: Find commits here: https://github.com/tdlib/td/commits/master'
exit 1
fi
docker build -t "tdlib:$TDLIB_VER-$UBUNTU_VERSION" --build-arg TDLIB_VER --build-arg UBUNTU_VERSION $(dirname $0)
if [ -z $SO_IMAGE_TAG ]
then
export SO_IMAGE_TAG="$IMAGE_TAG-so"
fi
echo "SO_IMAGE_TAG=$SO_IMAGE_TAG"
docker build \
-t "$SO_IMAGE_TAG" \
--build-arg "TDLIB_IMAGE=$IMAGE_TAG" \
--build-arg UBUNTU_VERSION \
-f Dockerfile-so \
.

Loading…
Cancel
Save