概要
google-cloud-bigquery
の最新バージョンをpython*alpineの最新版に入れようとしたら下記のようなエラーが出てインストールに失敗しました最終的に修正後のDockerfile
のようにしたところ無事インストールできました。
修正前のDockerfile
Dockerfile
FROM python:3.9.0-alpine3.12
RUN apk --update add \
curl \
bash
RUN apk --update add tzdata && \
cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
COPY ./requirements.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt
RUN curl -sSL https://sdk.cloud.google.com | bash
ENV PATH $PATH:/root/google-cloud-sdk/bin
RUN mkdir -p /src
FROM python:3.9.0-alpine3.12
RUN apk --update add \
curl \
gcc \
musl-dev \
linux-headers \
build-base \
libffi-dev \
bash
RUN apk --update add tzdata && \
cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
COPY ./requirements.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt
RUN curl -sSL https://sdk.cloud.google.com | bash
ENV PATH $PATH:/root/google-cloud-sdk/bin
- エラー1
error: command 'gcc' failed: No such file or directory
- エラー2
fatal error: limits.h: No such file or directory
- エラー3
fatal error: ffi.h: No such file or directory
requirements.txt
google-cloud-bigquery==2.4.0
修正後のDockerfile
Dockerfile
FROM python:3.9.0-alpine3.12
RUN apk --update add \
curl \
gcc \
musl-dev \
linux-headers \
build-base \
libffi-dev \
bash
RUN apk --update add tzdata && \
cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
COPY ./requirements.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt
RUN curl -sSL https://sdk.cloud.google.com | bash
ENV PATH $PATH:/root/google-cloud-sdk/bin
RUN mkdir -p /src
FROM python:3.9.0-alpine3.12
RUN apk --update add \
curl \
gcc \
musl-dev \
linux-headers \
build-base \
libffi-dev \
bash
RUN apk --update add tzdata && \
cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
COPY ./requirements.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt
RUN curl -sSL https://sdk.cloud.google.com | bash
ENV PATH $PATH:/root/google-cloud-sdk/bin