简体   繁体   English

在Docker中使用Fastlane构建iOS应用程序

[英]Building a iOS app with Fastlane inside Docker

I'm trying to streamline my iOS development builds and read about Docker. 我正在尝试简化我的iOS开发版本并阅读有关Docker的内容。

If I understood it right, I could create an image that would include all the dependencies and my fellow devs could just pull it and build inside it. 如果我理解正确的话,我可以创建一个包含所有依赖项的图像,而我的同伴开发人员可以将其拉入并在其中构建。

Point is now, does this also work with Fastlane (which uses the Xcode cli tools I think) and "Docker for Mac"? 点现在,这是否也适用于Fastlane(我认为使用Xcode cli工具)和“Docker for Mac”?

Also, I'm using React-Native, which seems to start a second process for bundling the JavaScript that will be included in the native build later and I read Docker only allows one process, is this a problem? 此外,我正在使用React-Native,它似乎启动了第二个进程,用于捆绑稍后将包含在本机构建中的JavaScript,并且我读到Docker只允许一个进程,这是一个问题吗?

The problem with using Docker is that even if you use Docker for mac, you won't have access to macOS-based images. 使用Docker的问题在于,即使您使用Docker for mac,您也无法访问基于macOS的图像。 Docker runs in a lightweight virtual machine called xhyve - at least if you install docker via the Docker for Mac package - that runs Linux on your mac. Docker在一个名为xhyve的轻量级虚拟机中运行 - 至少如果你通过Docker for Mac软件包安装docker - 在你的mac上运行Linux。

Essentially what this means is that your docker container is going to be limited to non-Xcode functionality. 本质上,这意味着您的docker容器将仅限于非Xcode功能。 Here's what you definitely won't be able to do, at least not without a non-trivial amount of work: 这是你绝对无法做到的,至少在没有非常重要的工作量的情况下:

  • Compile your app's native code 编译应用程序的本机代码
  • Take screenshots of your app or run your app in the Simulator 获取应用的屏幕截图或在模拟器中运行您的应用
  • Signing the finished app with Apple's codesign 签约完成应用程序与苹果公司的codesign

Here's things that you could potentially use your docker container for: 以下是您可能使用docker容器的内容:

  • Building the JS code (I assume, since RN should work on Linux) 构建JS代码(我假设,因为RN应该在Linux上运行)
  • Uploading your app with iTMSTransporter (ie using fastlane's deliver ) 使用iTMSTransporter上传您的应用程序(即使用fastlane的deliver
  • Downloading/Creating certificates, provisioning profiles and push certificates (ie fastlane's match , cert , pem and sigh ) 下载/创建证书,配置文件和推送证书(即fastlane的matchcertpemsigh
  • Working with git 使用git

All in all you're probably going to be very limited. 总而言之,你可能会非常有限。 Instead, it would be advisable to use things like Gemfile and Brewfile to list all your dependencies, and have a small setup.sh script that runs brew bundle and bundle install to install them on your colleague's machines. 相反,建议使用GemfileBrewfile类的东西来列出所有依赖项,并使用一个小型的setup.sh脚本运行brew bundlebundle install ,将它们安装在同事的机器上。 You can also set it up to run those during building (with Xcode's script build phases), so that no one can accidentally forget to install something that is needed for the build. 您还可以将其设置为在构建期间运行(使用Xcode的脚本构建阶段),这样就不会有人意外忘记安装构建所需的东西。

That being said, there is a fastlane docker image that is being worked on here that is also available on the Docker Hub . 话虽如此,还有一个正在这里工作的fastlane docker镜像,也可以在Docker Hub上使用 Note that it has only ever been tested to run the fastlane tests (that don't depend on macOS-only software), so it doesn't actually claim to run fastlane reliably. 请注意,它只是经过测试才能运行fastlane测试(不依赖于macOS专用软件),所以它实际上并没有声称能够可靠地运行fastlane。

I read Docker only allows one process 我读Docker只允许一个进程

Docker allows multiple processes, it just doesn't allow more than one main process. Docker允许多个进程,它只允许不允许多个主进程。 If your main process stops everything else and the container stops with it. 如果您的主进程停止其他所有操作并且容器随之停止。 If you just want to use it to install dependencies so that you can run one-off commands that use them, instead of hosting a long-running service, you can always do that by using docker run : 如果您只是想使用它来安装依赖项,以便您可以运行使用它们的一次性命令,而不是托管长时间运行的服务,您可以通过使用docker run

docker run <repo/image:tag> <your_command>

Or launch an interactive shell into the container: 或者在容器中启动交互式shell:

docker run -it <repo/image:tag> /bin/bash

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用“bundle exec Fastlane beta”构建 iOS 应用程序时出现问题 - Trouble when building iOS app using "bundle exec Fastlane beta" 在 iOS 上使用 fastlane 构建 Kotlin 多平台移动设备失败 - Building Kotlin Multiplatform Mobile with fastlane failing on iOS 使用FastLane自动化iOS应用程序 - Using FastLane to automate an iOS App 未找到签名证书“​​iOS 开发” - 使用 bitrise/Fastlane 匹配构建应用程序版本 - No signing certificate “iOS Development” found - building app release with bitrise/Fastlane match iOS 应用程序无法在 fastlane 中构建,但可以在 Xcode 中运行 - iOS app fails to build in fastlane but works in Xcode 使用fastlane使用Notification Extension构建iOS应用程序 - Build iOS app with Notification Extension with fastlane 如何使用快速通道操作修改iOS应用图标? - How to modify iOS App Icon with fastlane action? 是否可以在带有扩展的 iOS 应用上使用 Fastlane? - Is it possible to use Fastlane on an iOS app with extensions? 如何使用 fastlane 为模拟器构建 iOS 应用程序? - How to build iOS app for simulator using fastlane? 远程使用 fastlane 构建 ios 应用程序时出错 - Error when building ios application using fastlane remotely
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM