diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..15cf8a1 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +*/data +*/node_modules \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0692cb0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,41 @@ +FROM node:10 as ui-build +ARG NPM_REGISTRY="https://registry.npm.taobao.org" +ENV NPM_REGISTY=$NPM_REGISTRY + +WORKDIR /opt/guacamole +RUN npm config set registry ${NPM_REGISTRY} +RUN yarn config set registry ${NPM_REGISTRY} + +COPY ui ui/ +RUN ls . && cd ui/ && npm install -i && yarn build && ls . + +# /opt/guacamole/ui/guacamole + +FROM golang:1.15-alpine as go-build +WORKDIR /opt/guacamole +ARG GOPROXY=https://goproxy.io +ARG VERSION +ENV CGO_ENABLED=0 +ENV GO111MODULE=on +ENV GOOS=linux +COPY go.mod . +COPY go.sum . +RUN go mod download +COPY . . +RUN go build -o guacamole-client-go . && ls -al . + +FROM guacamole/guacd:1.3.0 +USER root +WORKDIR /opt/guacamole +ENV GUACD_LOG_LEVEL=debug +RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list \ + && sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list +RUN apt-get update && apt-get install -y supervisor +RUN mkdir -p /var/log/supervisor +COPY --from=ui-build /opt/guacamole/ui/guacamole ui/guacamole/ +COPY --from=go-build /opt/guacamole/guacamole-client-go . +COPY --from=go-build /opt/guacamole/config_example.yml . +COPY --from=go-build /opt/guacamole/supervisord.conf /etc/supervisor/conf.d/supervisord.conf +RUN ls -al . && pwd +EXPOSE 8081 +CMD ["/usr/bin/supervisord"] \ No newline at end of file diff --git a/supervisord.conf b/supervisord.conf new file mode 100644 index 0000000..2c67ebd --- /dev/null +++ b/supervisord.conf @@ -0,0 +1,16 @@ +[supervisord] +nodaemon=true + +[program:guacd] +command=/usr/local/guacamole/sbin/guacd -b 0.0.0.0 -L %(ENV_GUACD_LOG_LEVEL)s -f +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:guacamole-client-go] +command=/opt/guacamole/guacamole-client-go +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0