Skip to content

Instantly share code, notes, and snippets.

@ervitis
Created September 25, 2019 20:36
Show Gist options
  • Save ervitis/185652d57e068d019f17aec306483eab to your computer and use it in GitHub Desktop.
Save ervitis/185652d57e068d019f17aec306483eab to your computer and use it in GitHub Desktop.
FROM alpine:3.10
ARG MECAB_VERSION="0.996"
ARG IPADIC_VERSION="2.7.0-20070801"
ARG USERNAME="nroot"
ENV CGO_LDFLAGS -L/usr/lib/x86_64-linux-gnu -lmecab -lstdc++
ENV CGO_CFLAGS -I/usr/include
RUN apk add --no-cache alpine-sdk --virtual .builddeps
# doc https://taku910.github.io/mecab/#download
WORKDIR /tmp
RUN wget -O mecab-${MECAB_VERSION}.tar.gz 'https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7cENtOXlicTFaRUE' && \
tar zxf mecab-${MECAB_VERSION}.tar.gz && \
cd mecab-${MECAB_VERSION} && \
./configure && \
make && \
make check && \
make install && \
cd /tmp && \
wget -O mecab-ipadic-${IPADIC_VERSION}.tar.gz 'https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7MWVlSDBCSXZMTXM' && \
tar zxf mecab-ipadic-${IPADIC_VERSION}.tar.gz && \
cd mecab-ipadic-${IPADIC_VERSION} && \
./configure --enable-utf8-only && \
make && \
make install && \
apk del .builddeps && \
rm -rf /tmp/*
RUN addgroup -S ${USERNAME} && adduser -S ${USERNAME} -G ${USERNAME}
WORKDIR /home/${USERNAME}
RUN chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}
USER ${USERNAME}
WORKDIR /home/${USERNAME}
COPY <binary> .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment