Skip to content

Commit

Permalink
feat: update networking
Browse files Browse the repository at this point in the history
  • Loading branch information
scmmishra committed Dec 6, 2023
1 parent 713675a commit 555d25e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type App struct {
ImageName string `yaml:"image"`
Registry RegistryConfig `yaml:"registry"`
ContainerPort int `yaml:"container_port"`
Network string `yaml:"network"`
ENV []string `yaml:"env"`
PortRange PortRange `yaml:"port_range"`
}
Expand Down
6 changes: 5 additions & 1 deletion internal/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,17 @@ func RunContainer(imageName string, cfg config.DeploymentConfig) (*Container, er
PortBindings: nat.PortMap{
nat.Port(fmt.Sprintf("%d/tcp", cfg.App.ContainerPort)): []nat.PortBinding{
{
HostIP: "127.0.0.1",
HostIP: "0.0.0.0",
HostPort: fmt.Sprintf("%d", port),
},
},
},
}

if cfg.App.Network != "" {
hostConfig.NetworkMode = container.NetworkMode(cfg.App.Network)
}

resp, err := cli.ContainerCreate(ctx, containerConfig, hostConfig, nil, nil, "")
if err != nil {
return nil, err
Expand Down

0 comments on commit 555d25e

Please sign in to comment.