{"id":4660,"date":"2022-03-24T17:19:39","date_gmt":"2022-03-24T16:19:39","guid":{"rendered":"https:\/\/www.it-ps.at\/?p=4660"},"modified":"2024-10-16T11:10:32","modified_gmt":"2024-10-16T09:10:32","slug":"multi-stage-python","status":"publish","type":"post","link":"https:\/\/www.it-ps.at\/en\/multi-stage-python\/","title":{"rendered":"Multi Stage Python"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">When shipping applications using containers, one often is confronted with overly large final images. Multi-stage builds are a common way to circumvent this issue, especially for compiled languages like Go or Java. In our latest blog post we show how to utilise multi-stage builds for python images to bring down image sizes and thereby improving security.<\/p>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"has-col-16-abdd-color has-text-color wp-block-heading\">Using docker multi-stage builds to reduce image size<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">When writing container images, it is always preferable to have smaller images and to only include what is really needed. This has two main advantages:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>images take up less storage space<\/li><li>security vulnerabilities of software that is not installed cannot be exploited<\/li><\/ul>\n\n\n\n<h3 class=\"has-col-16-abdd-color has-text-color wp-block-heading\">Example dockerfile<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s take a very simple image that starts off with an official python-docker image, using a slim version of the current stable debian release, bullseye. We are going to use python 3.8, but this is not important. The image is pulled from <a href=\"https:\/\/hub.docker.com\/_\/python\" target=\"_blank\" rel=\"noreferrer noopener\">docker hub<\/a>.<br><br>The dockerfiles are provided in <a href=\"https:\/\/github.com\/it-power-services\/python-multi-stage-builds\" target=\"_blank\" rel=\"noreferrer noopener\">this repository<\/a> in the docker directory and can be built using <a href=\"https:\/\/pypi.org\/project\/pyodbc\/\" target=\"_blank\" rel=\"noreferrer noopener\">&#8216;.\/bin\/build.sh&#8217;<\/a> on Linux.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a id=\"_msocom_1\"><\/a><\/p>\n\n\n\n<h3 class=\"has-col-16-abdd-color has-text-color wp-block-heading\">Reducing the image size<\/h3>\n\n\n\n<h4 class=\"has-col-16-abdd-color has-text-color wp-block-heading\">The all-in-one solution<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">We are simply going to `COPY` over a `requirements.txt` and install it using `pip`, as this is a fairly common use case. I have chosen to install pyodbc since it has some system<br>dependencies that have to be installed.<br><br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Note: The dockerfiles are a <a href=\"https:\/\/stackoverflow.com\/help\/minimal-reproducible-example\" target=\"_blank\" rel=\"noreferrer noopener\">m<\/a><a>inimal reproducible example<\/a> and do not <em>follow some common best practices!<\/em><\/em><a id=\"_msocom_1\"><\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>```dockerfile\nFROM python:3.8-slim-bullseye\n\nRUN apt-get update &amp;&amp; \\\n    apt-get install -y gcc g++ unixodbc-dev\n\nCOPY requirements.txt \/tmp\/requirements.txt\n\nRUN pip3 install --no-cache-dir -r \/tmp\/requirements.txt\n```<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">After building the image, we get an image size of 422MB:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>```bash\n$ docker images original\nREPOSITORY   TAG       IMAGE ID       CREATED              SIZE\noriginal     latest    09ec99a1bafa   About a minute ago   422MB\n```<\/code><\/pre>\n\n\n\n<h4 class=\"has-col-16-abdd-color has-text-color wp-block-heading\">Introducing: multi-stage<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/docs.docker.com\/develop\/develop-images\/multistage-build\/\" target=\"_blank\" rel=\"noreferrer noopener\">Multi-stage builds<\/a> are a neat way to keep build dependencies from blowing up the size of your final image. I am not going to go into detail on how they work.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I am going to create wheels. From the <a href=\"https:\/\/pip.pypa.io\/en\/stable\/cli\/pip_wheel\/\" target=\"_blank\" rel=\"noreferrer noopener\">pip documentation<\/a>: <\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><em>&#8220;Wheel is a built-package format, and offers the advantage of not recompiling your software during every install.&#8221;<\/em><\/p><\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">And this is exactly what we want. Compile it and then reuse it without compilation.<br><br>The original dockerfile is split in 2: the builder image will install the build dependencies and create the wheels. The final image will install the packages from the wheels without the need to install any build tools:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>the wheels. The final image will install the packages from the wheels without the need to install any \n```dockerfile\nARG WHEEL_DIST=\"\/tmp\/wheels\"\n\nFROM python:3.8-slim-bullseye as builder\n\nARG WHEEL_DIST\n\nRUN apt-get update &amp;&amp; \\\n    apt-get install -y gcc g++ unixodbc-dev\n\nCOPY requirements.txt \/tmp\/requirements.txt\n\nRUN python3 -m pip wheel -w \"${WHEEL_DIST}\" -r \/tmp\/requirements.txt\n\n\nFROM python:3.8-slim-bullseye\n\nARG WHEEL_DIST\n\nCOPY --from=builder \"${WHEEL_DIST}\" \"${WHEEL_DIST}\"\n\nWORKDIR \"${WHEEL_DIST}\"\n\nRUN pip3 --no-cache-dir install *.whl\n``` <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The size of the image has gone down significantly:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>```bash\n$ docker images multi-stage\nREPOSITORY    TAG       IMAGE ID       CREATED          SIZE\nmulti-stage   latest    b90d97997b3b   44 seconds ago   128MB\n```<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The difference is starker when considering the size of the base image:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>```bash\ndocker images python:3.8-slim-bullseye\nREPOSITORY   TAG                 IMAGE ID       CREATED      SIZE\npython       3.8-slim-bullseye   caf584a25606   5 days ago   122MB\n```<\/code><\/pre>\n\n\n\n<h3 class=\"has-col-16-abdd-color has-text-color wp-block-heading\">Increasing security<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Smaller images can contribute to more security.<br>To illustrate this point, we are going to use <a href=\"https:\/\/github.com\/aquasecurity\/trivy\" target=\"_blank\" rel=\"noreferrer noopener\">trivy<\/a> to scan our images for known security vulnerabilities.<br><br>The base image has 85 vulnerabilities:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>LOW: 12<\/li><li>MEDIUM: 35<\/li><li>HIGH: 30<\/li><li>CRITICAL: 8<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The original image that includes the build tools has 331 total vulnerabilities:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a id=\"_msocom_1\"><\/a><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>UNKNOWN: 2<\/li><li>LOW: 24<\/li><li>MEDIUM: 175<\/li><li>HIGH: 109<\/li><li>CRITICAL: 21<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The multi-stage image again has 85 images that it &#8220;inherits&#8221; from the base image, but does not introduce any new ones.<br><a id=\"_msocom_1\"><\/a><\/p>\n\n\n\n<h3 class=\"has-col-16-abdd-color has-text-color wp-block-heading\">Summary<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">When using python, do utilise wheels and multi-stage builds to decrease the image size and increase the security of your deployements.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When shipping applications using containers, one often is confronted with overly large final images. Multi-stage builds are a common way to circumvent this issue, especially for compiled languages like Go or Java. In our latest blog post we show how to utilise multi-stage builds for python images to bring down image sizes and thereby improving [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":4666,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28,48],"tags":[],"class_list":["post-4660","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-ai","category-solutions-services"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"When shipping applications using containers, one often is confronted with overly large final images. Multi-stage builds are a common way to circumvent this issue, especially for compiled languages like Go or Java. In our latest blog post we show how to utilise multi-stage builds for python images to bring down image sizes and thereby improving\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"verena.hofer\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.it-ps.at\/en\/multi-stage-python\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"IT-PS - Power f\u00fcr Ihre IT\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Multi Stage Python - IT-PS\" \/>\n\t\t<meta property=\"og:description\" content=\"When shipping applications using containers, one often is confronted with overly large final images. Multi-stage builds are a common way to circumvent this issue, especially for compiled languages like Go or Java. In our latest blog post we show how to utilise multi-stage builds for python images to bring down image sizes and thereby improving\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.it-ps.at\/en\/multi-stage-python\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/www.it-ps.at\/wp-content\/uploads\/2022\/03\/ian-taylor-jOqJbvo1P9g-unsplash-scaled-1.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/www.it-ps.at\/wp-content\/uploads\/2022\/03\/ian-taylor-jOqJbvo1P9g-unsplash-scaled-1.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"2560\" \/>\n\t\t<meta property=\"og:image:height\" content=\"1706\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2022-03-24T16:19:39+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2024-10-16T09:10:32+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Multi Stage Python - IT-PS\" \/>\n\t\t<meta name=\"twitter:description\" content=\"When shipping applications using containers, one often is confronted with overly large final images. Multi-stage builds are a common way to circumvent this issue, especially for compiled languages like Go or Java. In our latest blog post we show how to utilise multi-stage builds for python images to bring down image sizes and thereby improving\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.it-ps.at\/wp-content\/uploads\/2022\/03\/ian-taylor-jOqJbvo1P9g-unsplash-scaled-1.jpg\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/multi-stage-python\\\/#blogposting\",\"name\":\"Multi Stage Python - IT-PS\",\"headline\":\"Multi Stage Python\",\"author\":{\"@id\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/author\\\/verena-hofer\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.it-ps.at\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/ian-taylor-jOqJbvo1P9g-unsplash-scaled-1.jpg\",\"width\":2560,\"height\":1706},\"datePublished\":\"2022-03-24T17:19:39+01:00\",\"dateModified\":\"2024-10-16T11:10:32+02:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/multi-stage-python\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/multi-stage-python\\\/#webpage\"},\"articleSection\":\"Data &amp; AI, IT-PS Solutions &amp; Services, Optional\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/multi-stage-python\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/#listItem\",\"position\":1,\"name\":\"Zu Hause\",\"item\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.it-ps.at\\\/insights\\\/blog\\\/data-ai\\\/#listItem\",\"name\":\"Data &amp; AI\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.it-ps.at\\\/insights\\\/blog\\\/data-ai\\\/#listItem\",\"position\":2,\"name\":\"Data &amp; AI\",\"item\":\"https:\\\/\\\/www.it-ps.at\\\/insights\\\/blog\\\/data-ai\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/multi-stage-python\\\/#listItem\",\"name\":\"Multi Stage Python\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/#listItem\",\"name\":\"Zu Hause\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/multi-stage-python\\\/#listItem\",\"position\":3,\"name\":\"Multi Stage Python\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.it-ps.at\\\/insights\\\/blog\\\/data-ai\\\/#listItem\",\"name\":\"Data &amp; AI\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/#organization\",\"name\":\"IT-PS\",\"description\":\"Power f\\u00fcr Ihre IT\",\"url\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.it-ps.at\\\/wp-content\\\/uploads\\\/2024\\\/07\\\/logo-it-ps.png\",\"@id\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/multi-stage-python\\\/#organizationLogo\",\"width\":525,\"height\":150},\"image\":{\"@id\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/multi-stage-python\\\/#organizationLogo\"},\"sameAs\":[\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCUm12_zcz1bIoy1B28Smacg\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/it-ps-deutschland\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/author\\\/verena-hofer\\\/#author\",\"url\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/author\\\/verena-hofer\\\/\",\"name\":\"verena.hofer\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/multi-stage-python\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/325515eb636ac57cd85dacc9ed6d2112ae7d7d7908acbc5cbb1662871b269ea1?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"verena.hofer\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/multi-stage-python\\\/#webpage\",\"url\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/multi-stage-python\\\/\",\"name\":\"Multi Stage Python - IT-PS\",\"description\":\"When shipping applications using containers, one often is confronted with overly large final images. Multi-stage builds are a common way to circumvent this issue, especially for compiled languages like Go or Java. In our latest blog post we show how to utilise multi-stage builds for python images to bring down image sizes and thereby improving\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/multi-stage-python\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/author\\\/verena-hofer\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/author\\\/verena-hofer\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.it-ps.at\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/ian-taylor-jOqJbvo1P9g-unsplash-scaled-1.jpg\",\"@id\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/multi-stage-python\\\/#mainImage\",\"width\":2560,\"height\":1706},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/multi-stage-python\\\/#mainImage\"},\"datePublished\":\"2022-03-24T17:19:39+01:00\",\"dateModified\":\"2024-10-16T11:10:32+02:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/\",\"name\":\"IT-PS\",\"description\":\"Power f\\u00fcr Ihre IT\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.it-ps.at\\\/en\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Multi Stage Python - IT-PS","description":"When shipping applications using containers, one often is confronted with overly large final images. Multi-stage builds are a common way to circumvent this issue, especially for compiled languages like Go or Java. In our latest blog post we show how to utilise multi-stage builds for python images to bring down image sizes and thereby improving","canonical_url":"https:\/\/www.it-ps.at\/en\/multi-stage-python\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/www.it-ps.at\/en\/multi-stage-python\/#blogposting","name":"Multi Stage Python - IT-PS","headline":"Multi Stage Python","author":{"@id":"https:\/\/www.it-ps.at\/en\/author\/verena-hofer\/#author"},"publisher":{"@id":"https:\/\/www.it-ps.at\/en\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/www.it-ps.at\/wp-content\/uploads\/2022\/03\/ian-taylor-jOqJbvo1P9g-unsplash-scaled-1.jpg","width":2560,"height":1706},"datePublished":"2022-03-24T17:19:39+01:00","dateModified":"2024-10-16T11:10:32+02:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/www.it-ps.at\/en\/multi-stage-python\/#webpage"},"isPartOf":{"@id":"https:\/\/www.it-ps.at\/en\/multi-stage-python\/#webpage"},"articleSection":"Data &amp; AI, IT-PS Solutions &amp; Services, Optional"},{"@type":"BreadcrumbList","@id":"https:\/\/www.it-ps.at\/en\/multi-stage-python\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.it-ps.at\/en\/#listItem","position":1,"name":"Zu Hause","item":"https:\/\/www.it-ps.at\/en\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.it-ps.at\/insights\/blog\/data-ai\/#listItem","name":"Data &amp; AI"}},{"@type":"ListItem","@id":"https:\/\/www.it-ps.at\/insights\/blog\/data-ai\/#listItem","position":2,"name":"Data &amp; AI","item":"https:\/\/www.it-ps.at\/insights\/blog\/data-ai\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.it-ps.at\/en\/multi-stage-python\/#listItem","name":"Multi Stage Python"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.it-ps.at\/en\/#listItem","name":"Zu Hause"}},{"@type":"ListItem","@id":"https:\/\/www.it-ps.at\/en\/multi-stage-python\/#listItem","position":3,"name":"Multi Stage Python","previousItem":{"@type":"ListItem","@id":"https:\/\/www.it-ps.at\/insights\/blog\/data-ai\/#listItem","name":"Data &amp; AI"}}]},{"@type":"Organization","@id":"https:\/\/www.it-ps.at\/en\/#organization","name":"IT-PS","description":"Power f\u00fcr Ihre IT","url":"https:\/\/www.it-ps.at\/en\/","logo":{"@type":"ImageObject","url":"https:\/\/www.it-ps.at\/wp-content\/uploads\/2024\/07\/logo-it-ps.png","@id":"https:\/\/www.it-ps.at\/en\/multi-stage-python\/#organizationLogo","width":525,"height":150},"image":{"@id":"https:\/\/www.it-ps.at\/en\/multi-stage-python\/#organizationLogo"},"sameAs":["https:\/\/www.youtube.com\/channel\/UCUm12_zcz1bIoy1B28Smacg","https:\/\/www.linkedin.com\/company\/it-ps-deutschland"]},{"@type":"Person","@id":"https:\/\/www.it-ps.at\/en\/author\/verena-hofer\/#author","url":"https:\/\/www.it-ps.at\/en\/author\/verena-hofer\/","name":"verena.hofer","image":{"@type":"ImageObject","@id":"https:\/\/www.it-ps.at\/en\/multi-stage-python\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/325515eb636ac57cd85dacc9ed6d2112ae7d7d7908acbc5cbb1662871b269ea1?s=96&d=mm&r=g","width":96,"height":96,"caption":"verena.hofer"}},{"@type":"WebPage","@id":"https:\/\/www.it-ps.at\/en\/multi-stage-python\/#webpage","url":"https:\/\/www.it-ps.at\/en\/multi-stage-python\/","name":"Multi Stage Python - IT-PS","description":"When shipping applications using containers, one often is confronted with overly large final images. Multi-stage builds are a common way to circumvent this issue, especially for compiled languages like Go or Java. In our latest blog post we show how to utilise multi-stage builds for python images to bring down image sizes and thereby improving","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.it-ps.at\/en\/#website"},"breadcrumb":{"@id":"https:\/\/www.it-ps.at\/en\/multi-stage-python\/#breadcrumblist"},"author":{"@id":"https:\/\/www.it-ps.at\/en\/author\/verena-hofer\/#author"},"creator":{"@id":"https:\/\/www.it-ps.at\/en\/author\/verena-hofer\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/www.it-ps.at\/wp-content\/uploads\/2022\/03\/ian-taylor-jOqJbvo1P9g-unsplash-scaled-1.jpg","@id":"https:\/\/www.it-ps.at\/en\/multi-stage-python\/#mainImage","width":2560,"height":1706},"primaryImageOfPage":{"@id":"https:\/\/www.it-ps.at\/en\/multi-stage-python\/#mainImage"},"datePublished":"2022-03-24T17:19:39+01:00","dateModified":"2024-10-16T11:10:32+02:00"},{"@type":"WebSite","@id":"https:\/\/www.it-ps.at\/en\/#website","url":"https:\/\/www.it-ps.at\/en\/","name":"IT-PS","description":"Power f\u00fcr Ihre IT","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.it-ps.at\/en\/#organization"}}]},"og:locale":"en_US","og:site_name":"IT-PS - Power f\u00fcr Ihre IT","og:type":"article","og:title":"Multi Stage Python - IT-PS","og:description":"When shipping applications using containers, one often is confronted with overly large final images. Multi-stage builds are a common way to circumvent this issue, especially for compiled languages like Go or Java. In our latest blog post we show how to utilise multi-stage builds for python images to bring down image sizes and thereby improving","og:url":"https:\/\/www.it-ps.at\/en\/multi-stage-python\/","og:image":"https:\/\/www.it-ps.at\/wp-content\/uploads\/2022\/03\/ian-taylor-jOqJbvo1P9g-unsplash-scaled-1.jpg","og:image:secure_url":"https:\/\/www.it-ps.at\/wp-content\/uploads\/2022\/03\/ian-taylor-jOqJbvo1P9g-unsplash-scaled-1.jpg","og:image:width":2560,"og:image:height":1706,"article:published_time":"2022-03-24T16:19:39+00:00","article:modified_time":"2024-10-16T09:10:32+00:00","twitter:card":"summary_large_image","twitter:title":"Multi Stage Python - IT-PS","twitter:description":"When shipping applications using containers, one often is confronted with overly large final images. Multi-stage builds are a common way to circumvent this issue, especially for compiled languages like Go or Java. In our latest blog post we show how to utilise multi-stage builds for python images to bring down image sizes and thereby improving","twitter:image":"https:\/\/www.it-ps.at\/wp-content\/uploads\/2022\/03\/ian-taylor-jOqJbvo1P9g-unsplash-scaled-1.jpg"},"aioseo_meta_data":{"post_id":"4660","title":null,"description":null,"keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"BlogPosting","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2024-08-29 12:17:53","updated":"2025-06-24 14:44:57","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.it-ps.at\/en\/\" title=\"Zu Hause\">Zu Hause<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.it-ps.at\/insights\/blog\/data-ai\/\" title=\"Data &amp; AI\">Data &amp; AI<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tMulti Stage Python\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Zu Hause","link":"https:\/\/www.it-ps.at\/en\/"},{"label":"Data &amp; AI","link":"https:\/\/www.it-ps.at\/insights\/blog\/data-ai\/"},{"label":"Multi Stage Python","link":"https:\/\/www.it-ps.at\/en\/multi-stage-python\/"}],"_links":{"self":[{"href":"https:\/\/www.it-ps.at\/en\/wp-json\/wp\/v2\/posts\/4660","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.it-ps.at\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.it-ps.at\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.it-ps.at\/en\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.it-ps.at\/en\/wp-json\/wp\/v2\/comments?post=4660"}],"version-history":[{"count":1,"href":"https:\/\/www.it-ps.at\/en\/wp-json\/wp\/v2\/posts\/4660\/revisions"}],"predecessor-version":[{"id":9889,"href":"https:\/\/www.it-ps.at\/en\/wp-json\/wp\/v2\/posts\/4660\/revisions\/9889"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.it-ps.at\/en\/wp-json\/wp\/v2\/media\/4666"}],"wp:attachment":[{"href":"https:\/\/www.it-ps.at\/en\/wp-json\/wp\/v2\/media?parent=4660"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.it-ps.at\/en\/wp-json\/wp\/v2\/categories?post=4660"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.it-ps.at\/en\/wp-json\/wp\/v2\/tags?post=4660"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}