diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..ae919e9e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +# Use the official Alpine-based Golang image as the build stage +FROM golang:1.18-alpine AS builder + +# Set the working directory +WORKDIR /go/src/github.com/quackduck/devzat + +# Copy the project source code into the container +COPY . . + +# Install project dependencies +RUN go mod download + +# Build the project +RUN go build -o devzat . + + + + +# Use the latest Alpine Linux image as the base for the final image +FROM alpine:latest + +# Install necessary tools +RUN apk add --no-cache openssh-server + +# Copy the compiled binary to the final image +COPY --from=builder /go/src/github.com/quackduck/devzat/devzat /usr/local/bin/devzat + +# Generate the SSH host key +RUN ssh-keygen -qN '' -f /etc/ssh/ssh_host_rsa_key + +# Expose the SSH port +EXPOSE 2221 443 5555 + +# Run the application (This line is commented out because the main service is the SSH server) +CMD ["/usr/local/bin/devzat"] diff --git a/README.md b/README.md index c9ea57cc..f932bc74 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,43 @@ devzat # run! the default config is used & written automatically ``` These commands download, build, setup and run a Devzat server listening on port 2221, the default port (change by setting `$PORT`). +Docker start: +```shell +git clone https://github.com/quackduck/devzat && cd devzat +docker build -t devzat . +docker run -d --name devzat -p 2221:2221 -p 443:443 devzat # Or consider using docker compose + +# Start enjoying +ssh yourname@127.0.0.1 -p 2222 +``` + +Docker Compose: +First use: +```shell +git clone https://github.com/quackduck/devzat && cd devzat +docker build -t devzat . +``` + +Create a docker-compose.yml file in the appropriate location: +```yaml +--- +services: + devzat: + image: devzat + container_name: devzat + environment: + - DEVZAT_CONFIG=/etc/devzat/devzat.yml #Create it by referring to the sample configuration file + volumes: + - ./devzat.yml:/etc/devzat/devzat.yml + - ./data:/opt/devzat + ports: + - "2221:2221" + - "443:443" + #- "5555:5555" #Optional + restart: always +``` + + Check out the [Admin's Manual](Admin's%20Manual.md) for complete self-host documentation! ### Permission denied?