diff --git a/.circleci/config.yml b/.circleci/config.yml index da66229..e069048 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,6 +10,9 @@ jobs: - run: name: Build Docker Image (Vanilla) command: docker build -t chinodesuuu/coder:vanilla -t chinodesuuu/coder:latest -f vanilla.Dockerfile . + - run: + name: Build Docker Image (v2) + command: docker build -t chinodesuuu/coder:v2 -t chinodesuuu/coder:che-v2 -f v2.dockerfile . - run: name: Build Docker Image (Satlus Test Image) command: docker build -t chinodesuuu/coder:vanilla -t chinodesuuu/coder:satlus -f satlus.Dockerfile . @@ -26,6 +29,9 @@ jobs: - run: name: Build Docker Image (Vanilla) command: docker build -t chinodesuuu/coder:vanilla -t chinodesuuu/coder:latest -f vanilla.Dockerfile . + - run: + name: Build Docker Image (v2) + command: docker build -t chinodesuuu/coder:v2 -t chinodesuuu/coder:che-v2 -f v2.dockerfile . - run: name: Build Docker Image (Satlus Test Image) command: docker build -t chinodesuuu/coder:vanilla -t chinodesuuu/coder:satlus -f satlus.Dockerfile . @@ -37,7 +43,7 @@ jobs: command: docker build -t chinodesuuu/coder:ubuntu -f ubuntu.Dockerfile . - run: name: Docker Push - command: docker login -u $DOCKER_USER -p $DOCKER_PASS && docker push chinodesuuu/coder:latest && docker push chinodesuuu/coder:openshift && docker push chinodesuuu/coder:vanilla && docker push chinodesuuu/coder:ubuntu && docker push chinodesuuu/coder:satlus; + command: docker login -u $DOCKER_USER -p $DOCKER_PASS && docker push chinodesuuu/coder:latest && docker push chinodesuuu/coder:openshift && docker push chinodesuuu/coder:vanilla && docker push chinodesuuu/coder:ubuntu && chinodesuuu/coder:v2 && docker push chinodesuuu/coder:satlus; workflows: version: 2 diff --git a/che-v2.dockerfile b/che-v2.dockerfile new file mode 100644 index 0000000..ee896bf --- /dev/null +++ b/che-v2.dockerfile @@ -0,0 +1,65 @@ +FROM debian:buster-slim + +ENV LANG=en_US.UTF-8 \ + # adding a sane default is needed since we're not erroring out via exec. + CODER_PASSWORD="coder" \ + SHELL=/bin/bash + +#Change this via --arg in Docker CLI +ARG CODER_VERSION=2.1523-vsc1.38.1 + +COPY exec-v2 /opt/exec + +RUN apt-get update && \ + apt-get install -y \ + sudo \ + openssl \ + net-tools \ + git \ + locales \ + curl \ + dumb-init \ + wget && \ + locale-gen en_US.UTF-8 && \ + apt clean && \ + rm -rf /var/lib/apt/lists/* && \ + cd /tmp && \ + wget -O - https://github.com/codercom/code-server/releases/download/${CODER_VERSION}/code-server${CODER_VERSION}-linux-x86_64.tar.gz | tar -xzv && \ + chmod -R 755 code-server${CODER_VERSION}-linux-x86_64/code-server && \ + mv code-server${CODER_VERSION}-linux-x86_64/code-server /usr/bin/ && \ + rm -rf code-server-${CODER_VERSION}-linux-x86_64 && \ + adduser --disabled-password --gecos '' coder && \ + echo '%sudo ALL=(ALL:ALL) NOPASSWD:ALL' >> /etc/sudoers && \ + echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd && \ + mkdir /projects && \ + chmod g+rw /projects && \ + chown coder:coder /projects &&\ + chgrp -R 0 /projects && \ + chmod -R g=u /projects && \ + chmod g+rw /home/coder && \ + chmod a+x /opt/exec && \ + chgrp -R 0 /home/coder && \ + chmod -R g=u /home/coder && \ + chmod g=u /etc/passwd; + +WORKDIR /home/coder + +USER coder + +RUN mkdir -p projects && mkdir -p certs && \ + curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash && \ + sudo chmod -R g+rw projects/ && \ + sudo chmod -R g+rw certs/ && \ + sudo chmod -R g+rw .nvm; + +COPY entrypoint /home/coder + +USER 10001 + +ENTRYPOINT ["/home/coder/entrypoint"] + +EXPOSE 9000 + +WORKDIR /projects + +CMD [ "dumb-init", "/usr/bin/code-server", "--port=9000", "/projects"] \ No newline at end of file diff --git a/exec-v2 b/exec-v2 new file mode 100755 index 0000000..a61c711 --- /dev/null +++ b/exec-v2 @@ -0,0 +1,30 @@ +#!/usr/bin/dumb-init /bin/sh + +# Special exec script to handle user cases that needs auth or +# stuff I can think of. + +# check for $CODER_ENABLE_AUTH. +case "${CODER_ENABLE_AUTH}" in + true) + case "${CODER_ENABLE_TLS}" in + true) + PASSWORD="${CODER_PASSWORD}" \ + /usr/bin/code-server --port=9000 --cert=/home/coder/certs/cert.crt --cert-key=/home/coder/certs/cert.key + ;; + *) + PASSWORD="${CODER_PASSWORD}" \ + /usr/bin/code-server --port=9000 + ;; + esac + ;; + *) + case "${CODER_ENABLE_TLS}" in + true) + /usr/bin/code-server --port=9000 --cert=/home/coder/certs/cert.crt --cert-key=/home/coder/certs/cert.key --auth=none + ;; + *) + /usr/bin/code-server --port=9000 --auth=none + ;; + esac + ;; +esac \ No newline at end of file diff --git a/v2-openshift.dockerfile b/v2-openshift.dockerfile new file mode 100644 index 0000000..e97e446 --- /dev/null +++ b/v2-openshift.dockerfile @@ -0,0 +1,60 @@ +FROM debian:buster-slim + +ENV LANG=en_US.UTF-8 \ + # adding a sane default is needed since we're not erroring out via exec. + CODER_PASSWORD="coder" \ + SHELL=/bin/bash + +#Change this via --arg in Docker CLI +ARG CODER_VERSION=2.1523-vsc1.38.1 + +COPY exec-v2 /opt/exec + +RUN apt-get update && \ + apt-get install -y \ + sudo \ + openssl \ + net-tools \ + git \ + locales \ + curl \ + dumb-init \ + wget && \ + locale-gen en_US.UTF-8 && \ + apt clean && \ + rm -rf /var/lib/apt/lists/* && \ + cd /tmp && \ + wget -O - https://github.com/codercom/code-server/releases/download/${CODER_VERSION}/code-server${CODER_VERSION}-linux-x86_64.tar.gz | tar -xzv && \ + chmod -R 755 code-server${CODER_VERSION}-linux-x86_64/code-server && \ + mv code-server${CODER_VERSION}-linux-x86_64/code-server /usr/bin/ && \ + rm -rf code-server-${CODER_VERSION}-linux-x86_64 && \ + adduser --disabled-password --gecos '' coder && \ + echo '%sudo ALL=(ALL:ALL) NOPASSWD:ALL' >> /etc/sudoers && \ + echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd && \ + chmod g+rw /home/coder && \ + chmod a+x /opt/exec && \ + chgrp -R 0 /home/coder && \ + chmod -R g=u /home/coder && \ + chmod g=u /etc/passwd; + +WORKDIR /home/coder + +USER coder + +RUN mkdir -p projects && mkdir -p certs && \ + curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash && \ + sudo chmod -R g+rw projects/ && \ + sudo chmod -R g+rw certs/ && \ + sudo chmod -R g+rw .nvm; + +COPY entrypoint /home/coder + +VOLUME ["/home/coder/projects", "/home/coder/certs"]; + +USER 10001 + +ENTRYPOINT ["/home/coder/entrypoint"] + +EXPOSE 9000 + +CMD ["/opt/exec"] \ No newline at end of file diff --git a/v2.dockerfile b/v2.dockerfile new file mode 100644 index 0000000..0eba993 --- /dev/null +++ b/v2.dockerfile @@ -0,0 +1,58 @@ +FROM debian:buster-slim + +ENV LANG=en_US.UTF-8 \ + # adding a sane default is needed since we're not erroring out via exec. + CODER_PASSWORD="coder" \ + SHELL=/bin/bash + +#Change this via --arg in Docker CLI +ARG CODER_VERSION=2.1523-vsc1.38.1 + +COPY exec-v2 /opt/exec + +RUN apt-get update && \ + apt-get install -y \ + sudo \ + openssl \ + net-tools \ + git \ + locales \ + curl \ + dumb-init \ + wget && \ + locale-gen en_US.UTF-8 && \ + apt clean && \ + rm -rf /var/lib/apt/lists/* && \ + cd /tmp && \ + wget -O - https://github.com/codercom/code-server/releases/download/${CODER_VERSION}/code-server${CODER_VERSION}-linux-x86_64.tar.gz | tar -xzv && \ + chmod -R 755 code-server${CODER_VERSION}-linux-x86_64/code-server && \ + mv code-server${CODER_VERSION}-linux-x86_64/code-server /usr/bin/ && \ + rm -rf code-server-${CODER_VERSION}-linux-x86_64 && \ + adduser --disabled-password --gecos '' coder && \ + echo '%sudo ALL=(ALL:ALL) NOPASSWD:ALL' >> /etc/sudoers && \ + echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd && \ + chmod g+rw /home/coder && \ + chmod a+x /opt/exec && \ + chgrp -R 0 /home/coder && \ + chmod -R g=u /home/coder && \ + chmod g=u /etc/passwd; + +WORKDIR /home/coder + +USER coder + +RUN mkdir -p projects && mkdir -p certs && \ + curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash && \ + sudo chmod -R g+rw projects/ && \ + sudo chmod -R g+rw certs/ && \ + sudo chmod -R g+rw .nvm; + +COPY entrypoint /home/coder + +VOLUME ["/home/coder/projects", "/home/coder/certs"]; + +USER 1000 + +EXPOSE 9000 + +CMD ["/opt/exec"] \ No newline at end of file