mirror of
https://github.com/deuill/coreos-home-server.git
synced 2024-09-21 13:40:45 +00:00
Makefile: Make virtual port configuration dynamic
This commit is contained in:
parent
6e08aba560
commit
e46588f60c
21
Makefile
21
Makefile
@ -4,8 +4,8 @@ STREAM := stable
|
|||||||
VERSION := 37.20221127.3.0
|
VERSION := 37.20221127.3.0
|
||||||
ARCH := x86_64
|
ARCH := x86_64
|
||||||
IMAGE_URI := https://builds.coreos.fedoraproject.org/prod/streams/
|
IMAGE_URI := https://builds.coreos.fedoraproject.org/prod/streams/
|
||||||
HOST := $(if $(HOST),$(HOST),$(error Please specify a valid HOST to deploy))
|
HOST := $(if $(filter deploy,$(MAKECMDGOALS)),$(if $(HOST),$(HOST),$(error Please specify a valid HOST to deploy)),$(HOST))
|
||||||
TYPE := $(if $(filter virtual,$(HOST)),virtual,$(if $(TYPE),$(TYPE),$(error Please specify a valid deployment TYPE)))
|
TYPE := $(if $(filter deploy,$(MAKECMDGOALS)),$(if $(filter virtual,$(HOST)),virtual,$(if $(TYPE),$(TYPE),$(error Please specify a valid deployment TYPE))),$(TYPE))
|
||||||
|
|
||||||
# Default Makefile options.
|
# Default Makefile options.
|
||||||
VERBOSE :=
|
VERBOSE :=
|
||||||
@ -15,13 +15,14 @@ TMPDIR := $(shell ls -d /var/tmp/$(NAME).???? 2>/dev/null || mktemp -d /var/tmp
|
|||||||
# Target-specific variables.
|
# Target-specific variables.
|
||||||
ADDRESS = $(shell ip -o route get 1 | awk '{for (i=1; i<=NF; i++) {if ($$i == "src") {print $$(i+1); exit}}}')
|
ADDRESS = $(shell ip -o route get 1 | awk '{for (i=1; i<=NF; i++) {if ($$i == "src") {print $$(i+1); exit}}}')
|
||||||
CONTAINERFILES = $(wildcard service/*/Containerfile)
|
CONTAINERFILES = $(wildcard service/*/Containerfile)
|
||||||
|
VIRTUAL_PORTS = 8022:22 8080:80 8443:443
|
||||||
|
|
||||||
# Build-time dependencies.
|
# Build-time dependencies.
|
||||||
BUTANE ?= $(call find-cmd,butane)
|
BUTANE ?= $(call find-cmd,butane)
|
||||||
PODMAN ?= $(call find-cmd,podman)
|
PODMAN ?= $(call find-cmd,podman)
|
||||||
CURL ?= $(call find-cmd,curl) $(if $(VERBOSE),,--progress-bar) --fail
|
CURL ?= $(call find-cmd,curl) $(if $(VERBOSE),,--progress-bar) --fail
|
||||||
GPG ?= $(call find-cmd,gpg) $(if $(VERBOSE),,-q)
|
GPG ?= $(call find-cmd,gpg) $(if $(VERBOSE),,-q)
|
||||||
QEMU ?= $(call find-cmd,qemu-system-x86_64) -enable-kvm
|
QEMU ?= $(call find-cmd,qemu-system-$(ARCH)) -enable-kvm
|
||||||
NC ?= $(call find-cmd,nc) -vv -r -l
|
NC ?= $(call find-cmd,nc) -vv -r -l
|
||||||
|
|
||||||
## Builds and deploys Fedora CoreOS for HOST of TYPE.
|
## Builds and deploys Fedora CoreOS for HOST of TYPE.
|
||||||
@ -57,7 +58,7 @@ deploy-virtual: $(TMPDIR)images/fedora-coreos-$(VERSION)-qemu.$(ARCH).qcow2.xz $
|
|||||||
$Q $(QEMU) -m 2048 -cpu host -nographic -snapshot \
|
$Q $(QEMU) -m 2048 -cpu host -nographic -snapshot \
|
||||||
-fw_cfg name=opt/com.coreos/config,file=$(TMPDIR)deploy/host/$(HOST)/spec.ign \
|
-fw_cfg name=opt/com.coreos/config,file=$(TMPDIR)deploy/host/$(HOST)/spec.ign \
|
||||||
-drive if=virtio,file=$(TMPDIR)images/fedora-coreos-$(VERSION)-qemu.$(ARCH).qcow2 \
|
-drive if=virtio,file=$(TMPDIR)images/fedora-coreos-$(VERSION)-qemu.$(ARCH).qcow2 \
|
||||||
-nic user,model=virtio,hostfwd=tcp::8022-:22,hostfwd=tcp::8080-:80,hostfwd=tcp::8443-:443
|
-nic user,model=virtio,$(subst $(SPACE),$(COMMA),$(foreach p,$(VIRTUAL_PORTS),hostfwd=tcp::$(subst :,-:,$(p))))
|
||||||
|
|
||||||
# Build container file locally using 'podman build'.
|
# Build container file locally using 'podman build'.
|
||||||
$(CONTAINERFILES):
|
$(CONTAINERFILES):
|
||||||
@ -116,10 +117,14 @@ Q := $(if $(VERBOSE),,@)
|
|||||||
find-cmd = $(or $(firstword $(wildcard $(addsuffix /$(1),$(subst :, ,$(PATH))))),$(error "Command '$(1)' not found in PATH"))
|
find-cmd = $(or $(firstword $(wildcard $(addsuffix /$(1),$(subst :, ,$(PATH))))),$(error "Command '$(1)' not found in PATH"))
|
||||||
|
|
||||||
# Shell colors, used in messages.
|
# Shell colors, used in messages.
|
||||||
BOLD := \033[1m
|
BOLD = \033[1m
|
||||||
UNDERLINE := \033[4m
|
UNDERLINE = \033[4m
|
||||||
BLUE := \033[36m
|
BLUE = \033[36m
|
||||||
RESET := \033[0m
|
RESET = \033[0m
|
||||||
|
|
||||||
|
# Variables for reserved characters.
|
||||||
|
SPACE = $(eval) $(eval)
|
||||||
|
COMMA = ,
|
||||||
|
|
||||||
# Dependency includes.
|
# Dependency includes.
|
||||||
include $(TMPDIR)make.depend
|
include $(TMPDIR)make.depend
|
||||||
|
@ -11,6 +11,7 @@ ENV PATH=/venv/bin:/root/.local/bin:$PATH
|
|||||||
RUN python3 -m venv /venv && python3 -m pip install wheel
|
RUN python3 -m venv /venv && python3 -m pip install wheel
|
||||||
RUN curl -fL https://install.python-poetry.org | python3 -
|
RUN curl -fL https://install.python-poetry.org | python3 -
|
||||||
|
|
||||||
|
ARG PLUGINS="skype discord"
|
||||||
RUN cd /slidge && poetry export --extras="$PLUGINS" > requirements.txt && \
|
RUN cd /slidge && poetry export --extras="$PLUGINS" > requirements.txt && \
|
||||||
python3 -m pip install --requirement requirements.txt
|
python3 -m pip install --requirement requirements.txt
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user