From 5c2ef715b396ecc6076a9f4b4ef75866cec0ff6d Mon Sep 17 00:00:00 2001 From: "@k33g" Date: Sat, 20 Jan 2024 10:13:52 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=B3=20Docker:=20work=20on=20compose=20?= =?UTF-8?q?file,=20add=20tasks,=20DnD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 2 ++ .tasks/init.sh | 18 ++++++++++++++++++ compose.yaml | 23 +++++++++++++++++++---- 3 files changed, 39 insertions(+), 4 deletions(-) create mode 100755 .tasks/init.sh diff --git a/.env b/.env index 7024528..ea650df 100644 --- a/.env +++ b/.env @@ -19,5 +19,7 @@ CODER_ARCH=arm64 CODER_HTTP_PORT=4000 USER_NAME=simplism # Add this to your hosts file: 0.0.0.0 ide.simplism.cloud +LOCAL_DOMAIN=ide.simplism.cloud TLS_CERT=ide.simplism.cloud.crt TLS_CERT_KEY=ide.simplism.cloud.key + diff --git a/.tasks/init.sh b/.tasks/init.sh new file mode 100755 index 0000000..bfb3c92 --- /dev/null +++ b/.tasks/init.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# ------------------------------------ +# Install Code Server Extensions +# ------------------------------------ +code-server --install-extension wesbos.theme-cobalt2 +code-server --install-extension PKief.material-icon-theme +code-server --install-extension PKief.material-product-icons +code-server --install-extension golang.go +code-server --install-extension rust-lang.rust-analyzer +code-server --install-extension aaron-bond.better-comments +code-server --install-extension GitHub.github-vscode-theme +code-server --install-extension huytd.github-light-monochrome + +echo "🌍 open: http://0.0.0.0:${CODER_HTTP_PORT}" +echo "🔐 if you activated https mode:" +echo "🌍 open: https://${LOCAL_DOMAIN}:${CODER_HTTP_PORT}" + diff --git a/compose.yaml b/compose.yaml index d4246d4..86ddfb0 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,15 +1,20 @@ # Simplism services: - app: + simplism-project: container_name: ${CONTAINER_NAME} # https entrypoint: ["code-server", "--cert", "/${WORKDIR}/certs/${TLS_CERT}", "--cert-key", "/${WORKDIR}/certs/${TLS_CERT_KEY}", "--auth", "none", "--host", "0.0.0.0", "--port", "${CODER_HTTP_PORT}", "/${WORKDIR}"] # http #entrypoint: ["code-server", "--auth", "none", "--host", "0.0.0.0", "--port", "${CODER_HTTP_PORT}", "/${WORKDIR}"] - environment: + environment: &env - ABOUT="Simplism Environment with Coder" - XDG_DATA_HOME=/${WORKDIR}/.config - build: + - CODER_HTTP_PORT=${CODER_HTTP_PORT} + # used by the https mode + - LOCAL_DOMAIN=${LOCAL_DOMAIN} + - TLS_CERT=${TLS_CERT} + - TLS_CERT_KEY=${TLS_CERT_KEY} + build: &build args: - GO_ARCH=${GO_ARCH} - GO_VERSION=${GO_VERSION} @@ -40,5 +45,15 @@ services: source: /var/run/docker.sock target: /var/run/docker.sock ports: - - 4000:4000 # Code Server HTTP port + - ${CODER_HTTP_PORT}:${CODER_HTTP_PORT} # Code Server HTTP port - 8080:8080 + + simplism-project-tasks: + depends_on: + - simplism-project + container_name: ${CONTAINER_NAME}-tasks + entrypoint: ["/${WORKDIR}/.tasks/init.sh"] + environment: *env + build: *build + volumes: + - .:/${WORKDIR}