Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Docker support #233

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected] -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?
Expand Down