answer-with-oss / Dockerfile
Anyexyz's picture
Update Dockerfile
8c2e566 verified
FROM apache/answer:1.4.0 as answer-builder
FROM golang:1.19-alpine AS golang-builder
COPY --from=answer-builder /usr/bin/answer /usr/bin/answer
RUN sed -i 's#https\?://dl-cdn.alpinelinux.org/alpine#https://mirrors.tuna.tsinghua.edu.cn/alpine#g' /etc/apk/repositories
RUN apk --no-cache add \
build-base git bash nodejs npm go && \
npm install -g pnpm@8.9.2
RUN answer build \
--with github.com/apache/incubator-answer-plugins/connector-basic \
--with github.com/apache/incubator-answer-plugins/storage-aliyunoss \
--with github.com/apache/incubator-answer-plugins/search-elasticsearch \
--with github.com/apache/incubator-answer-plugins/captcha-basic \
--output /usr/bin/new_answer
FROM alpine
LABEL maintainer="linkinstar@apache.org"
ARG TIMEZONE
ENV TIMEZONE=${TIMEZONE:-"Asia/Shanghai"}
RUN sed -i 's#https\?://dl-cdn.alpinelinux.org/alpine#https://mirrors.tuna.tsinghua.edu.cn/alpine#g' /etc/apk/repositories
RUN apk update \
&& apk --no-cache add \
bash \
ca-certificates \
curl \
dumb-init \
gettext \
openssh \
sqlite \
gnupg \
tzdata \
&& ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
&& echo "${TIMEZONE}" > /etc/timezone
COPY --from=golang-builder /usr/bin/new_answer /usr/bin/answer
COPY --from=answer-builder /data /data
COPY --from=answer-builder /entrypoint.sh /entrypoint.sh
RUN chmod 755 /entrypoint.sh
VOLUME /data
EXPOSE 80
ENTRYPOINT ["/entrypoint.sh"]