services/templates/compose/docker-compose.yaml.gotmpl

105 lines
2.6 KiB
Go Template
Raw Normal View History

{{- 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 -}}
2022-11-18 15:08:16 +00:00
---
2022-11-18 19:05:58 +00:00
version: "3.9"
2022-11-18 15:08:16 +00:00
networks:
2022-11-18 19:05:58 +00:00
flow:
name: "flow"
2022-11-18 15:08:16 +00:00
ipam:
driver: "default"
config:
- subnet: "{{ .DockerNetworkSubnet }}"
2022-11-18 15:08:16 +00:00
volumes:
traefik-shared:
name: "traefik-config-shared-volume"
services:
# -- Traffic flow --
traefik:
container_name: "traffic-flow"
image: "localhost/flow/traefik:{{ .Traefik.Version }}"
2022-11-18 15:08:16 +00:00
build:
2022-11-18 19:05:58 +00:00
context: "../traefik"
2022-11-18 15:08:16 +00:00
networks:
2022-11-18 19:05:58 +00:00
flow:
ipv4_address: "{{ .Traefik.ContainerIpv4Address }}"
2022-11-18 15:08:16 +00:00
ports:
- target: 80
published: 80
protocol: "tcp"
mode: "host"
- target: 443
published: 443
protocol: "tcp"
mode: "host"
- target: {{ .Traefik.ExternalSSHPort }}
published: {{ .Traefik.ExternalSSHPort }}
2022-11-18 15:08:16 +00:00
protocol: "tcp"
mode: "host"
restart: "always"
volumes:
{{- template "defaultVolumes" }}
# Shared volume
2022-11-18 15:08:16 +00:00
- type: "volume"
source: "traefik-shared"
target: "{{ .Traefik.SharedMountPoint }}"
2022-11-18 15:08:16 +00:00
# Traefik TLS volume
- type: "bind"
source: "{{ .Traefik.TlsHostDirectory }}"
target: "{{ .Traefik.TlsContainerDirectory }}"
2022-11-18 15:08:16 +00:00
# -- Code flow --
forgejo:
2022-11-18 15:08:16 +00:00
container_name: "code-flow"
image: "localhost/flow/forgejo:{{ .Forgejo.Version }}"
2022-11-18 15:08:16 +00:00
build:
context: "../forgejo"
2022-11-18 15:08:16 +00:00
expose:
- "{{ .Forgejo.SshPort }}"
- "{{ .Forgejo.HttpPort }}"
2022-11-18 15:08:16 +00:00
networks:
2022-11-18 19:05:58 +00:00
flow:
ipv4_address: "{{ .Forgejo.ContainerIpv4Address }}"
2022-11-18 15:08:16 +00:00
restart: "always"
volumes:
{{- template "defaultVolumes" }}
# Shared volume
2022-11-18 15:08:16 +00:00
- type: "volume"
source: "traefik-shared"
target: "{{ .Traefik.SharedMountPoint }}"
# Forgejo data volume
2022-11-18 15:08:16 +00:00
- 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 }}"