This commit is contained in:
Nite07 2024-10-06 20:38:42 +08:00
parent a95fda9e18
commit 0c51061149
6 changed files with 42 additions and 4 deletions

View File

@ -28,4 +28,4 @@ jobs:
push: true push: true
tags: nite07/dev-env:latest tags: nite07/dev-env:latest
platforms: linux/amd64 platforms: linux/amd64
file: ./Dockerfile-dev-env.dockerfile context: ./dev-env

View File

@ -30,4 +30,4 @@ jobs:
push: true push: true
tags: nite07/tailscale-derp-docker:latest tags: nite07/tailscale-derp-docker:latest
platforms: linux/amd64,linux/arm64,linux/arm/v7 platforms: linux/amd64,linux/arm64,linux/arm/v7
file: ./Dockerfile-tailscale-derper.dockerfile context: ./tailscale-derper

View File

@ -8,9 +8,12 @@ RUN apt-get update && apt-get install -y \
unzip \ unzip \
make \ make \
gcc \ 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 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 tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz
RUN rm 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/golangci/golangci-lint/cmd/golangci-lint@latest
RUN go install github.com/goreleaser/goreleaser/v2@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"] CMD ["bash"]

View File

@ -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

13
dev-env/start.sh Normal file
View File

@ -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 "$@"