services/templates/compose/docker-compose.yaml.gotmpl
Dan Anglin 3340ddc475
build: automation with Go and Mage
We shall now use Go and Mage to manage the Flow services. The templates
have been converted to Go templates, Mage has replaced Make and the
helper bash scripts have been rewritten in Go.
2023-02-12 20:59:55 +00:00

104 lines
2.6 KiB
Go Template

{{- define "defaultVolumes" }}
- type: "bind"
source: "/etc/timezone"
target: "/etc/timezone"
read_only: true
- type: "bind"
source: "/etc/localtime"
target: "/etc/localtime"
read_only: true
{{- end -}}
---
version: "3.9"
networks:
flow:
name: "flow"
ipam:
driver: "default"
config:
- subnet: "{{ .DockerNetworkSubnet }}"
volumes:
traefik-shared:
name: "traefik-config-shared-volume"
services:
# -- Traffic flow --
traefik:
container_name: "traffic-flow"
image: "localhost/flow/traefik:{{ .Traefik.Version }}"
build:
context: "../traefik"
networks:
flow:
ipv4_address: "{{ .Traefik.ContainerIpv4Address }}"
ports:
- target: 80
published: 80
protocol: "tcp"
mode: "host"
- target: 443
published: 443
protocol: "tcp"
mode: "host"
- target: {{ .Traefik.ExternalSSHPort }}
published: {{ .Traefik.ExternalSSHPort }}
protocol: "tcp"
mode: "host"
restart: "always"
volumes:
{{- template "defaultVolumes" }}
# Shared volume
- type: "volume"
source: "traefik-shared"
target: "{{ .Traefik.SharedMountPoint }}"
# Traefik TLS volume
- type: "bind"
source: "{{ .Traefik.TlsHostDirectory }}"
target: "{{ .Traefik.TlsContainerDirectory }}"
# -- Code flow --
forgejo:
container_name: "code-flow"
image: "localhost/flow/forgejo:{{ .Forgejo.Version }}"
build:
context: "../forgejo"
expose:
- "{{ .Forgejo.SshPort }}"
- "{{ .Forgejo.HttpPort }}"
networks:
flow:
ipv4_address: "{{ .Forgejo.ContainerIpv4Address }}"
restart: "always"
volumes:
{{- template "defaultVolumes" }}
# Shared volume
- type: "volume"
source: "traefik-shared"
target: "{{ .Traefik.SharedMountPoint }}"
# Forgejo data volume
- type: "bind"
source: "{{ .Forgejo.DataHostDirectory }}"
target: "{{ .Forgejo.DataContainerDirectory }}"
# -- Free Flow 2 --
gotosocial:
container_name: "free-flow"
image: "localhost/flow/gotosocial:{{ .GoToSocial.Version }}"
build:
context: "../gotosocial"
expose:
- "{{ .GoToSocial.Port }}"
networks:
flow:
ipv4_address: "{{ .GoToSocial.ContainerIpv4Address }}"
restart: "always"
volumes:
{{- template "defaultVolumes" }}
# Shared volume
- type: "volume"
source: "traefik-shared"
target: "{{ .Traefik.SharedMountPoint }}"
# Go To Social data volume
- type: "bind"
source: "{{ .GoToSocial.DataHostDirectory }}"
target: "{{ .GoToSocial.DataContainerDirectory }}"