forked from naqvis/pipy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[build] Add Dockerfile for building image on Loongarch.
- Loading branch information
Showing
2 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
deps/zlib-*/build/ | ||
deps/openssl-*/build/ | ||
deps/libexpat-*/testdata/ | ||
**/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
FROM cr.loongnix.cn/loongson/loongnix-server:8.3 as builder | ||
LABEL maintainer="Kevein Liu<khas@flomesh.io>" | ||
|
||
ENV pkg_prefix /usr/local | ||
ENV pkg_confdir /etc/pipy | ||
ENV pkg_bindir ${pkg_prefix}/bin | ||
ENV CXX clang++ | ||
ENV CC clang | ||
|
||
ARG VERSION | ||
ENV VERSION=${VERSION} | ||
|
||
ARG REVISION | ||
ENV REVISION=${REVISION} | ||
|
||
ARG COMMIT_ID | ||
ENV CI_COMMIT_SHA=${COMMIT_ID} | ||
|
||
ARG COMMIT_DATE | ||
ENV CI_COMMIT_DATE=${COMMIT_DATE} | ||
|
||
ARG PIPY_GUI | ||
ENV PIPY_GUI=${PIPY_GUI:-OFF} | ||
|
||
ARG PIPY_STATIC | ||
ENV PIPY_STATIC=${PIPY_STATIC:-OFF} | ||
|
||
ARG SU_EXEC_URL=https://codeload.github.com/ncopa/su-exec/tar.gz/refs/tags/v0.2 | ||
|
||
COPY . /pipy | ||
|
||
RUN yum install -y --quiet openssh-clients cmake clang autoconf automake zlib zlib-devel pkgconf file nodejs npm make | ||
|
||
RUN if [ "$PIPY_GUI" == "ON" ] ; then cd pipy && npm install && npm run build; fi | ||
|
||
RUN rm -fr pipy/build \ | ||
&& mkdir pipy/build \ | ||
&& cd pipy/build \ | ||
&& curl -sL "${SU_EXEC_URL}" | tar -C /tmp -zxf - \ | ||
&& make -C "/tmp/su-exec-0.2" \ | ||
&& cp "/tmp/su-exec-0.2/su-exec" /usr/bin \ | ||
&& rm -fr "/tmp/su-exec-0.2" \ | ||
&& export CI_COMMIT_SHA \ | ||
&& export CI_COMMIT_TAG=${VERSION}-${REVISION} \ | ||
&& export CI_COMMIT_DATE \ | ||
&& cmake -DPIPY_GUI=${PIPY_GUI} -DPIPY_STATIC=${PIPY_STATIC} -DPIPY_TUTORIAL=${PIPY_GUI} -DCMAKE_BUILD_TYPE=Release .. \ | ||
&& make -j$(getconf _NPROCESSORS_ONLN) \ | ||
&& mkdir ${pkg_confdir} \ | ||
&& cp /pipy/bin/pipy ${pkg_bindir} | ||
|
||
FROM cr.loongnix.cn/loongson/loongnix-server:8.3 as prod | ||
COPY --from=builder /pipy/bin/pipy /usr/local/bin/pipy | ||
COPY --from=builder /pipy/tutorial /etc/pipy | ||
COPY --from=builder /usr/bin/su-exec /usr/bin/su-exec | ||
RUN yum install -y --quiet ca-certificates libstdc++ libcap tar curl iptables tzdata socat logrotate | ||
RUN useradd -ru 1340 pipy \ | ||
&& chmod -R g=u /usr/local/bin/pipy /etc/pipy \ | ||
&& chown -R pipy:0 /usr/local/bin/pipy /etc/pipy | ||
|
||
COPY docker-entrypoint.sh /docker-entrypoint.sh | ||
|
||
USER pipy | ||
EXPOSE 6000 | ||
STOPSIGNAL SIGQUIT | ||
|
||
ENTRYPOINT ["/docker-entrypoint.sh"] | ||
CMD ["pipy", "docker-start"] |