gpt4 book ai didi

django - Django-无法在Alpine中编译消息?

转载 作者:行者123 更新时间:2023-12-02 21:14:32 24 4
gpt4 key购买 nike

我正在尝试将docker镜像迁移到基于alpine的镜像,但是遇到一个问题,即在镜像构建期间无法编译消息。

FROM python:3.6-alpine
ENV PYTHONUNBUFFERED 1

# Creating working directory
RUN mkdir /code
WORKDIR /code

# Copying requirements
COPY ./myproject/ .

RUN apk add --no-cache --virtual .build-deps \
ca-certificates gcc postgresql-dev linux-headers musl-dev \
libffi-dev jpeg-dev zlib-dev \
&& pip install -r requirements.txt \
&& find /usr/local \
\( -type d -a -name test -o -name tests \) \
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
-exec rm -rf '{}' + \
&& runDeps="$( \
scanelf --needed --nobanner --recursive /usr/local \
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
| sort -u \
| xargs -r apk info --installed \
| sort -u \
)" \
&& apk add --virtual .rundeps $runDeps \
&& apk del .build-deps

RUN python manage.py compilemessages

我唯一的问题是在编译消息的步骤中。这里的错误
CommandError: Can't find msgfmt. Make sure you have GNU gettext tools 0.15 or newer installed.

最佳答案

您需要将gettext添加到dockerfile中。您可以使用:RUN apk add gettext进行添加。和Alpine软件包链接:https://pkgs.alpinelinux.org/package/edge/main/x86/gettext

关于django - Django-无法在Alpine中编译消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52032712/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com