diff --git a/.github/workflows/docker-dev-env.yml b/.github/workflows/docker-dev-env.yml index a63a2bf..9a2ce13 100644 --- a/.github/workflows/docker-dev-env.yml +++ b/.github/workflows/docker-dev-env.yml @@ -28,4 +28,4 @@ jobs: push: true tags: nite07/dev-env:latest platforms: linux/amd64 - file: ./Dockerfile-dev-env.dockerfile + context: ./dev-env diff --git a/.github/workflows/docker-tailscale-derper.yml b/.github/workflows/docker-tailscale-derper.yml index 1858f78..84ee047 100644 --- a/.github/workflows/docker-tailscale-derper.yml +++ b/.github/workflows/docker-tailscale-derper.yml @@ -30,4 +30,4 @@ jobs: push: true tags: nite07/tailscale-derp-docker:latest platforms: linux/amd64,linux/arm64,linux/arm/v7 - file: ./Dockerfile-tailscale-derper.dockerfile + context: ./tailscale-derper diff --git a/Dockerfile-dev-env.dockerfile b/dev-env/Dockerfile similarity index 62% rename from Dockerfile-dev-env.dockerfile rename to dev-env/Dockerfile index da2138b..303c36f 100644 --- a/Dockerfile-dev-env.dockerfile +++ b/dev-env/Dockerfile @@ -8,9 +8,12 @@ RUN apt-get update && apt-get install -y \ unzip \ make \ gcc \ - build-essential + build-essential \ + openssh-server -ENV GO_VERSION=1.23.2 +RUN rm -rf /var/lib/apt/lists/* + +ENV GO_VERSION=1.21.3 RUN curl -OL https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz RUN tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz RUN rm go${GO_VERSION}.linux-amd64.tar.gz @@ -26,4 +29,14 @@ RUN go install golang.org/x/tools/gopls@latest RUN go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest RUN go install github.com/goreleaser/goreleaser/v2@latest +RUN mkdir /var/run/sshd +RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config +RUN sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config + +EXPOSE 22 + +COPY start.sh /start.sh +RUN chmod +x /start.sh + +ENTRYPOINT ["/start.sh"] CMD ["bash"] diff --git a/dev-env/docker-compose.yaml b/dev-env/docker-compose.yaml new file mode 100644 index 0000000..e3b3e3d --- /dev/null +++ b/dev-env/docker-compose.yaml @@ -0,0 +1,12 @@ +services: + dev-env: + image: nite07/dev-env:latest + volumes: + - ./workspace:/workspace + restart: unless-stopped + tty: true + stdin_open: true + ports: + - 2222:22 + environment: + - SSH_PASSWORD=changeme diff --git a/dev-env/start.sh b/dev-env/start.sh new file mode 100644 index 0000000..460adb9 --- /dev/null +++ b/dev-env/start.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +if [ -z "$SSH_PASSWORD" ]; then + echo "Error: SSH_PASSWORD is not set. Please provide a password." + exit 1 +fi + +echo "root:$SSH_PASSWORD" | chpasswd +echo "SSH password for root is set to: $SSH_PASSWORD" + +service ssh start + +exec "$@" diff --git a/Dockerfile-tailscale-derper.dockerfile b/tailscale-derper/Dockerfile similarity index 100% rename from Dockerfile-tailscale-derper.dockerfile rename to tailscale-derper/Dockerfile