From 607bf0849499d34ac2e2dbb55141488ff55d4ce0 Mon Sep 17 00:00:00 2001 From: Shuanglei Tao Date: Sun, 8 Dec 2019 22:31:45 +0800 Subject: [PATCH] Dockerfile: use bash --- .github/workflows/backend.yml | 8 ++++---- .github/workflows/frontend.yml | 2 +- Dockerfile | 15 +++++++-------- Dockerfile-alpine | 12 ++++++------ 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml index 7e3ee86..d4520ef 100644 --- a/.github/workflows/backend.yml +++ b/.github/workflows/backend.yml @@ -17,11 +17,11 @@ jobs: matrix: lws-version: [3.2.0, 3.1.0, 2.4.2] steps: - - name: install apt packages + - name: Install packages run: | sudo apt-get update sudo apt-get install build-essential cmake libjson-c-dev libssl-dev libuv1-dev - - name: compile libwebsockets-${{ matrix.lws-version }} from source + - name: Install libwebsockets-${{ matrix.lws-version }} env: LWS_VERSION: ${{ matrix.lws-version }} run: | @@ -31,7 +31,7 @@ jobs: cmake -DLWS_WITH_LIBUV=ON -DLWS_UNIX_SOCK=ON -DLWS_IPV6=ON -DLWS_WITHOUT_TESTAPPS=ON -DCMAKE_BUILD_TYPE=RELEASE . make && sudo make install && sudo ldconfig - uses: actions/checkout@v1 - - name: build ttyd + - name: Build ttyd run: | cmake -DCMAKE_BUILD_TYPE=RELEASE . make && sudo make install @@ -43,7 +43,7 @@ jobs: arch: [i386, x86_64, arm, armhf, mips, mipsel] steps: - uses: actions/checkout@v1 - - name: cross build (${{ matrix.arch }}) + - name: Cross build (${{ matrix.arch }}) env: ARCH: ${{ matrix.arch }} run: docker run --rm -v $(pwd):/ttyd -w /ttyd tsl0922/musl-cross ./scripts/cross-build.sh $ARCH diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index 5c419c0..d0f7e07 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/setup-node@v1 with: node-version: '12.x' - - name: yarn install, check and build + - name: Run yarn install, check and build run: | cd html yarn install diff --git a/Dockerfile b/Dockerfile index 493cfaf..5f3b2c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,14 @@ FROM tsl0922/musl-cross -RUN git clone --depth=1 https://github.com/tsl0922/ttyd.git /tmp/ttyd \ - && cd /tmp/ttyd && ./scripts/cross-build.sh x86_64 +RUN git clone --depth=1 https://github.com/tsl0922/ttyd.git /ttyd \ + && cd /ttyd && ./scripts/cross-build.sh x86_64 FROM ubuntu:18.04 -COPY --from=0 /tmp/ttyd/build/ttyd /usr/local/bin/ttyd +COPY --from=0 /ttyd/build/ttyd /usr/bin/ttyd -ENV TINI_VERSION v0.18.0 -ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini -RUN chmod +x /tini +ADD https://github.com/krallin/tini/releases/download/v0.18.0/tini /sbin/tini +RUN chmod +x /sbin/tini EXPOSE 7681 -ENTRYPOINT ["/tini", "--"] -CMD ["ttyd", "sh"] +ENTRYPOINT ["/sbin/tini", "--"] +CMD ["ttyd", "bash"] diff --git a/Dockerfile-alpine b/Dockerfile-alpine index 168b0cd..7f20f0d 100644 --- a/Dockerfile-alpine +++ b/Dockerfile-alpine @@ -1,12 +1,12 @@ FROM tsl0922/musl-cross -RUN git clone --depth=1 https://github.com/tsl0922/ttyd.git /tmp/ttyd \ - && cd /tmp/ttyd && ./scripts/cross-build.sh x86_64 +RUN git clone --depth=1 https://github.com/tsl0922/ttyd.git /ttyd \ + && cd /ttyd && ./scripts/cross-build.sh x86_64 -FROM alpine:3.9 -COPY --from=0 /tmp/ttyd/build/ttyd /usr/local/bin/ttyd -RUN apk add --no-cache tini +FROM alpine:3.10 +COPY --from=0 /ttyd/build/ttyd /usr/bin/ttyd +RUN apk add --no-cache bash tini EXPOSE 7681 ENTRYPOINT ["/sbin/tini", "--"] -CMD ["ttyd", "sh"] +CMD ["ttyd", "bash"] -- 2.43.4