mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Add switch for LTO in Docker image
This commit is contained in:
parent
0b2b3416d7
commit
da2f1b3d97
3 changed files with 6 additions and 3 deletions
2
.github/workflows/docker.yml
vendored
2
.github/workflows/docker.yml
vendored
|
@ -31,7 +31,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
cd Telegram/build/docker/centos_env
|
cd Telegram/build/docker/centos_env
|
||||||
poetry install
|
poetry install
|
||||||
DEBUG= poetry run gen_dockerfile | docker buildx build -t $IMAGE_TAG -
|
DEBUG= LTO= poetry run gen_dockerfile | docker buildx build -t $IMAGE_TAG -
|
||||||
|
|
||||||
- name: Push the Docker image.
|
- name: Push the Docker image.
|
||||||
if: ${{ github.ref_name == github.event.repository.default_branch }}
|
if: ${{ github.ref_name == github.event.repository.default_branch }}
|
||||||
|
|
|
@ -44,10 +44,12 @@ RUN mkdir /opt/cmake \
|
||||||
&& rm {{ CMAKE_FILE }}
|
&& rm {{ CMAKE_FILE }}
|
||||||
|
|
||||||
FROM builder-base AS builder
|
FROM builder-base AS builder
|
||||||
|
{%- if LTO %}
|
||||||
ENV AR gcc-ar
|
ENV AR gcc-ar
|
||||||
ENV RANLIB gcc-ranlib
|
ENV RANLIB gcc-ranlib
|
||||||
ENV NM gcc-nm
|
ENV NM gcc-nm
|
||||||
ENV CFLAGS {% if DEBUG %}-g{% endif %} -Ofast {% if DEBUG %}-flto=auto -ffat-lto-objects{% endif %} -pipe -fPIC -fstack-protector-all -fstack-clash-protection -DNDEBUG -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS
|
{%- endif %}
|
||||||
|
ENV CFLAGS {% if DEBUG %}-g{% endif %} -Ofast {% if LTO %}-flto=auto -ffat-lto-objects{% endif %} -pipe -fPIC -fstack-protector-all -fstack-clash-protection -DNDEBUG -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS
|
||||||
ENV CXXFLAGS $CFLAGS
|
ENV CXXFLAGS $CFLAGS
|
||||||
|
|
||||||
FROM builder AS patches
|
FROM builder AS patches
|
||||||
|
|
|
@ -5,7 +5,8 @@ from jinja2 import Environment, FileSystemLoader
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
print(Environment(loader=FileSystemLoader(dirname(__file__))).get_template("Dockerfile").render(
|
print(Environment(loader=FileSystemLoader(dirname(__file__))).get_template("Dockerfile").render(
|
||||||
DEBUG=bool(len(environ["DEBUG"])) if "DEBUG" in environ else True
|
DEBUG=bool(len(environ["DEBUG"])) if "DEBUG" in environ else True,
|
||||||
|
LTO=bool(len(environ["LTO"])) if "LTO" in environ else True,
|
||||||
))
|
))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Add table
Reference in a new issue