elm make在高山码头工人集装箱中失败

问题描述 投票:0回答:1

我正在尝试将elm应用程序(code is open source)码头化,这是我的Dockerfile

# set base image as alpine
FROM alpine:3.11.2 AS builder

# download the elm compiler and extract it to /user/local/bin/elm
RUN wget -O - 'https://github.com/elm/compiler/releases/download/0.19.1/binary-for-linux-64-bit.gz' \
    | gunzip -c >/usr/local/bin/elm

# make the elm compiler executable
RUN chmod +x /usr/local/bin/elm

# update remote repositories
RUN apk update

# install nodejs
RUN apk add --update nodejs npm

# install uglifyjs
RUN npm install uglify-js --global

# set the working directory for any RUN, CMD, ENTRYPOINT, COPY and ADD
# instructions that follows the WORKDIR instruction.
WORKDIR /app

# remember, our current working directory within the container is /app
# we now copy everything (except stuff listed in .dockerignore)
# from local machine to /app (in the container).
COPY . .

# build elm production code
RUN elm make src/app/Main.elm --optimize --output=elm.js

当我运行docker build . --no-cache时,出现以下错误:

ConnectionFailure Network.Socket.getAddrInfo(使用首选的套接字类型/协议调用:AddrInfo {addrFlags = [AI_ADDRCONFIG],addrFamily = AF_UNSPEC,addrSocketType =流,addrProtocol = 0,addrAddress =,addrCanonName =},主机名:Just“ package .elm-lang.org”,服务名称:仅“ 443”):不存在(再试一次)

这是它的外观:

elm make error inside docker container

我没有任何连接问题,如果确实有任何连接问题,那么您会认为安装nodejs和uglifyjs也会失败,对吗?那些安装没有任何问题。

我很困惑,不确定要怎么做。

docker elm elm-make
1个回答
0
投票

看来这是操作系统级别的网络问题。一个简单的技巧是将make命令包装在无限重试循环中(在另一个脚本中),然后运行该脚本]]

#!/usr/bin/env bash

while :
do
  elm make src/app/Main.elm --optimize --output=elm.js
  [ $? -eq 0 ] &&  exit # exit if above command is successful
done

并且在您的Dockerfile中,将最后一行更改为

# build elm production code
RUN ./retry.sh
© www.soinside.com 2019 - 2024. All rights reserved.