Skip to content

Commit

Permalink
Adding containers to simulate multiple clients
Browse files Browse the repository at this point in the history
  • Loading branch information
Unic-X committed Nov 15, 2024
1 parent 419508f commit 4d68e40
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM golang:1.23-alpine AS builder

WORKDIR /app

COPY go.mod go.sum ./
RUN go mod download

COPY . .

RUN go build -o /goback main.go

FROM alpine:latest

RUN apk add openssh

RUN mkdir -p /app/private /app/data

RUN ssh-keygen -t rsa -b 4096 -f /app/private/id_rsa

COPY --from=builder /goback /usr/local/bin/goback

CMD ["goback"]

3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ BINARY=goback

all: build

poner: #install but in spanish
go install

tidy:
go mod tidy

Expand Down
22 changes: 22 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
services:
server:
build: .
command: ["goback", "server"]
ports:
- "8080:8080" # Replace with your server's port
volumes:
- ./data:/app/data
- ./private/id_rsa:/app/private/id_rsa
client:
tty: true
stdin_open: true
build: .
command: ["goback", "client"]
depends_on:
- server
environment:
- TERM=xterm-256color # Add any environment variables needed for the client
volumes:
- ./data:/app/data
deploy:
replicas: 1 # Specifies the number of client replicas
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
github.com/aclements/go-rabin v0.0.0-20170911142644-d0b643ea1a4c
github.com/charmbracelet/huh v0.6.0
github.com/charmbracelet/log v0.4.0
github.com/fsnotify/fsnotify v1.8.0
github.com/ncruces/go-sqlite3 v0.20.0
github.com/pkg/sftp v1.13.6
github.com/spf13/cobra v1.8.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkp
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4=
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM=
github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M=
github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4=
github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
Expand Down

0 comments on commit 4d68e40

Please sign in to comment.