services/templates/compose/docker-compose.yaml.gotmpl
Dan Anglin 32ee6bded6
chore: clean up docker compose file
Remove traefik and woodpecker from the docker compose file.
2024-10-22 03:33:20 +01:00

141 lines
3.9 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: "{{ .Docker.Network.Name }}"
ipam:
driver: "default"
config:
- subnet: "{{ .Docker.Network.Subnet }}"
services:
# -- Edge flow --
caddy:
container_name: "{{ .Caddy.ContainerName }}"
image: "localhost/flow/caddy:{{ .Caddy.Version }}"
build:
context: "../caddy"
networks:
flow:
ipv4_address: "{{ .Caddy.ContainerIpv4Address }}"
ports:
- target: 80
published: 80
protocol: "tcp"
mode: "host"
- target: 443
published: 443
protocol: "tcp"
mode: "host"
- target: 443
published: 443
protocol: "udp"
mode: "host"
restart: "always"
volumes:
{{- template "defaultVolumes" }}
# Caddy data volume
- type: "bind"
source: "{{ .Caddy.DataHostDirectory }}"
target: "{{ .Caddy.DataContainerDirectory }}"
# Caddy config volume
- type: "bind"
source: "{{ .Caddy.ConfigHostDirectory }}"
target: "{{ .Caddy.ConfigContainerDirectory }}"
{{- if .Caddy.TLS.UseCustomCertificates -}}
{{ print "" }}
# Caddy TLS volume
- type: "bind"
source: "{{ .Caddy.TLS.HostDirectory }}"
target: "{{ .Caddy.TLS.ContainerDirectory }}"
{{- end -}}
{{ print "" }}
# -- Code flow --
forgejo:
container_name: "{{ .Forgejo.ContainerName }}"
image: "localhost/flow/forgejo:{{ .Forgejo.Version }}"
build:
context: "../forgejo"
{{- if eq .Forgejo.ContainerRunMode "backup" }}
command:
- forgejo
- dump
- --config
- {{ .Forgejo.AppIni }}
- --file
- {{ .Forgejo.Backups.ContainerDirectory }}/forgejo-backup-v{{ .Forgejo.Version }}-{{ timestamp }}.tar.gz
- --type
- tar.gz
{{- end }}
expose:
- "{{ .Forgejo.HttpPort }}"
{{- if .Forgejo.StartSSHServer -}}
{{ print "" }}
- "{{ .Forgejo.SshPort }}"
{{- end -}}
{{ print "" }}
networks:
flow:
ipv4_address: "{{ .Forgejo.ContainerIpv4Address }}"
{{- if eq .Forgejo.ContainerRunMode "backup" }}
restart: "no"
{{- else }}
restart: "always"
{{- end }}
volumes:
{{- template "defaultVolumes" }}
# Forgejo data volume
- type: "bind"
source: "{{ .Forgejo.DataHostDirectory }}"
target: "{{ .Forgejo.DataContainerDirectory }}"
# -- Free Flow --
gotosocial:
container_name: "{{ .GoToSocial.ContainerName }}"
image: "localhost/flow/gotosocial:{{ .GoToSocial.Version }}"
build:
context: "../gotosocial"
environment:
TZ: {{ .GoToSocial.TZ }}
expose:
- "{{ .GoToSocial.Port }}"
networks:
flow:
ipv4_address: "{{ .GoToSocial.ContainerIpv4Address }}"
restart: "always"
volumes:
{{- template "defaultVolumes" }}
# Go To Social data volume
- type: "bind"
source: "{{ .GoToSocial.DataHostDirectory }}"
target: "{{ .GoToSocial.DataContainerDirectory }}"
# -- Landing Page --
landing:
container_name: "{{ .Landing.ContainerName }}"
command:
- --address={{ .Landing.ContainerIpv4Address }}:{{ .Landing.Port }}
{{ range .Landing.Services -}}
- --service=title={{ .Title }},url={{ .URL }}{{ if gt (len .Rel) 0 }},rel={{ .Rel }}{{ end }}
{{ end -}}
{{ range .Landing.Profiles -}}
- --profile=title={{ .Title }},url={{ .URL }}{{ if gt (len .Rel) 0 }},rel={{ .Rel }}{{ end }}
{{ end -}}
image: "codeflow.dananglin.me.uk/flow/landing:v{{ .Landing.Version }}@{{ .Landing.ImageDigest }}"
expose:
- "{{ .Landing.Port }}"
networks:
flow:
ipv4_address: "{{ .Landing.ContainerIpv4Address }}"
restart: "always"
volumes:
{{- template "defaultVolumes" }}