diff --git a/docker/Dockerfile b/docker/Dockerfile index ae9f79e..30a4f36 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -9,9 +9,11 @@ RUN curl -fsSL https://deb.nodesource.com/setup_17.x | bash - \ && npm install -g yarn \ && cargo install just -RUN git clone https://github.com/Eugeny/warpgate /opt/warpgate \ - && cd /opt/warpgate \ +COPY . /opt/warpgate + +RUN cd /opt/warpgate \ && just yarn \ + && just openapi \ && just yarn build \ && cargo build @@ -19,13 +21,12 @@ FROM debian:bullseye LABEL maintainer=heywoodlh COPY --from=build /opt/warpgate/target/debug/warpgate /usr/local/bin/warpgate -COPY run.sh /run.sh -COPY expect.sh /expect.sh +COPY docker/run.sh /run.sh ENV DEBIAN_FRONTEND noninteractive RUN apt-get update \ - && apt-get install -y expect openssl \ + && apt-get install -y openssl \ && rm -rf /var/lib/apt/lists/* EXPOSE 2222 diff --git a/docker/expect.sh b/docker/expect.sh deleted file mode 100755 index 1e694bd..0000000 --- a/docker/expect.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/expect -f - -set password [lindex $argv 0]; - -spawn warpgate hash -expect "*Password to be hashed*" -send -- "$password\r" -expect eof diff --git a/docker/run.sh b/docker/run.sh index 8cbb0d6..def7c4a 100755 --- a/docker/run.sh +++ b/docker/run.sh @@ -5,7 +5,7 @@ [[ -e /data/web-admin.certificate.pem ]] || openssl req -x509 -nodes -days 7300 -newkey rsa:4096 -keyout /data/web-admin.key.pem -out /data/web-admin.certificate.pem -subj "/C=PE/ST=Lima/L=Lima/O=Acme Inc. /OU=IT Department/CN=acme.com" -password_hash=$(/expect.sh "${ADMIN_PASS}" | tail -1 | sed 's/\r$//') +password_hash=$(echo -n "${ADMIN_PASS}" | warpgate hash | cat) cat << EOF > /etc/warpgate.yaml ---