using more variables

This commit is contained in:
Nathan Price 2024-12-02 20:42:57 -05:00
parent 4d4f156716
commit e36404e290
Signed by: gravityfargo
SSH key fingerprint: SHA256:bjq+uA1U+9bFMd70q2wdNtwaYxGv84IBXalnYvZDKmg

View file

@ -1,21 +1,30 @@
IMAGE_NAME=bluesky-pds REGISTRY=forgejo.gravityfargo.dev
IMAGE_TAG=0.4.74 OWNER=gravityfargo
IMAGE=bluesky-pds
TAG=0.4.74
CONFIG_FILE=config/pds.env
export DOCKER_BUILDKIT=1 export DOCKER_BUILDKIT=1
# export BUILDKIT_PROGRESS=plain # export BUILDKIT_PROGRESS=plain
.PHONY: build .PHONY: build
build: build:
docker build --tag $(IMAGE_NAME):$(IMAGE_TAG) . docker build --tag $(REGISTRY)/$(OWNER)/$(IMAGE):$(TAG) .
.PHONY: create-config .PHONY: create-config
create-config: create-config:
@echo "PDS_JWT_SECRET=" >> pds.env @if [ -f $(CONFIG_FILE) ]; then \
@echo "PDS_ADMIN_PASSWORD=" >> pds.env echo "Config already exists. Exiting."; \
@echo "PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX=" >> pds.env exit 0; \
@echo "PDS_HOSTNAME=" >> pds.env else \
@echo "Done." mkdir -p config; \
@echo "run 'make generate' to generate secrets" echo "PDS_JWT_SECRET=" >> $(CONFIG_FILE); \
echo "PDS_ADMIN_PASSWORD=" >> $(CONFIG_FILE); \
echo "PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX=" >> $(CONFIG_FILE); \
echo "PDS_HOSTNAME=" >> $(CONFIG_FILE); \
echo "Done."; \
echo "run 'make generate' to generate secrets"; \
fi
.PHONY: generate-secrets .PHONY: generate-secrets
generate-secrets: generate-secrets:
@ -26,12 +35,16 @@ generate-secrets:
$(eval PDS_JWT_SECRET=$(shell ${GENERATE_SECURE_SECRET_CMD})) $(eval PDS_JWT_SECRET=$(shell ${GENERATE_SECURE_SECRET_CMD}))
$(eval PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX=$(shell ${GENERATE_K256_PRIVATE_KEY_CMD})) $(eval PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX=$(shell ${GENERATE_K256_PRIVATE_KEY_CMD}))
@sed -i "s/^PDS_ADMIN_PASSWORD=.*/PDS_ADMIN_PASSWORD=${PDS_ADMIN_PASSWORD}/" pds.env || echo "PDS_ADMIN_PASSWORD=${PDS_ADMIN_PASSWORD}" >> pds.env @sed -i "s/^PDS_ADMIN_PASSWORD=.*/PDS_ADMIN_PASSWORD=${PDS_ADMIN_PASSWORD}/" $(CONFIG_FILE) || echo "PDS_ADMIN_PASSWORD=${PDS_ADMIN_PASSWORD}" >> $(CONFIG_FILE)
@sed -i "s/^PDS_JWT_SECRET=.*/PDS_JWT_SECRET=${PDS_JWT_SECRET}/" pds.env || echo "PDS_JWT_SECRET=${PDS_JWT_SECRET}" >> pds.env @sed -i "s/^PDS_JWT_SECRET=.*/PDS_JWT_SECRET=${PDS_JWT_SECRET}/" $(CONFIG_FILE) || echo "PDS_JWT_SECRET=${PDS_JWT_SECRET}" >> $(CONFIG_FILE)
@sed -i "s/^PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX=.*/PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX=${PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX}/" pds.env || echo "PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX=${PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX}" >> pds.env @sed -i "s/^PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX=.*/PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX=${PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX}/" $(CONFIG_FILE) || echo "PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX=${PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX}" >> $(CONFIG_FILE)
@echo "Done." @echo "Done."
.PHONY: run .PHONY: run
run: run:
docker compose up docker compose up
.PHONY: push
push:
docker push $(REGISTRY)/$(OWNER)/$(IMAGE):$(TAG)