简体   繁体   English

如何使用 docker 构建 React Native iOS 应用程序?

[英]How to build react native iOS app with docker?

I want to build my react native iOS app using docker, My problem is that when I run react-native run-ios I'm getting an error that it cant find the simulator.我想使用 docker 构建我的 react native iOS 应用程序,我的问题是,当我运行react-native run-ios我收到一个错误,提示它找不到模拟器。 I know the issue occur because I don't have Xcode on my docker.我知道这个问题的发生是因为我的 docker 上没有 Xcode。

I was looking for image for Mac or Xcode but all found is a few images for old versions of Xcode and they are not working anymore, I couldn't find images for Mac or any other way to install Xcode on my docker or install iOS simulator on image that isn't Mac OS.我正在寻找 Mac 或 Xcode 的图像,但所有发现都是一些旧版本 Xcode 的图像,它们不再工作,我找不到 Mac 图像或任何其他方式在我的 docker 上安装 Xcode 或安装 iOS 模拟器在非 Mac OS 的图像上。

Im attaching my docker:我附上了我的码头工人:

FROM openjdk:8 as builder
ENV SDK_URL "https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip"
ENV ANDROID_HOME /usr/src/app
ENV ANDROID_BUILD_TOOLS_VERSION 28.0.3
ENV ANDROID_VERSION 28
ENV PATH $PATH:$ANDROID_HOME/bin
ARG NODE_VERSION=12.x
WORKDIR /usr/src/app
COPY package*.json ./

# installing android and java
RUN apt update -qq && apt install -qq -y --no-install-recommends \
       apt-transport-https \
       curl \
       build-essential \
       file \
       git \
       openjdk-8-jre \
       gnupg2 \
       python \
       ruby-full \
       openssh-client \
       zip \
       unzip \
   && rm -rf /var/lib/apt/lists/*/;  


RUN npm i -g react-native-cli
#installing libraries
RUN npm install
COPY . .
RUN react-native run-ios;

Thank you for the help感谢您的帮助

This can't be done right now.这现在不能做。 The reason being that only macOS systems can develop native iOS apps;原因是只有 macOS 系统才能开发原生 iOS 应用程序; therefore, react native doesn't support iOS development on anything but a Mac.因此,react native 不支持在 Mac 以外的任何设备上进行 iOS 开发。 Docker containers are all built on Linux, not macOS, so this is currently unfeasible, unfortunately. Docker 容器都是在 Linux 上构建的,而不是 macOS,因此不幸的是,目前这是不可行的。 See this post .看到这个帖子

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM