diff --git a/Makefile b/Makefile index 2d6f6b8..648fabb 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,30 @@ -IMAGE_NAME=bluesky-pds -IMAGE_TAG=0.4.74 +REGISTRY=forgejo.gravityfargo.dev +OWNER=gravityfargo +IMAGE=bluesky-pds +TAG=0.4.74 +CONFIG_FILE=config/pds.env export DOCKER_BUILDKIT=1 # export BUILDKIT_PROGRESS=plain .PHONY: build build: - docker build --tag $(IMAGE_NAME):$(IMAGE_TAG) . + docker build --tag $(REGISTRY)/$(OWNER)/$(IMAGE):$(TAG) . .PHONY: create-config create-config: - @echo "PDS_JWT_SECRET=" >> pds.env - @echo "PDS_ADMIN_PASSWORD=" >> pds.env - @echo "PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX=" >> pds.env - @echo "PDS_HOSTNAME=" >> pds.env - @echo "Done." - @echo "run 'make generate' to generate secrets" + @if [ -f $(CONFIG_FILE) ]; then \ + echo "Config already exists. Exiting."; \ + exit 0; \ + else \ + mkdir -p config; \ + 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 generate-secrets: @@ -26,12 +35,16 @@ generate-secrets: $(eval PDS_JWT_SECRET=$(shell ${GENERATE_SECURE_SECRET_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_JWT_SECRET=.*/PDS_JWT_SECRET=${PDS_JWT_SECRET}/" pds.env || echo "PDS_JWT_SECRET=${PDS_JWT_SECRET}" >> 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}/" 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_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}/" $(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}/" $(CONFIG_FILE) || echo "PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX=${PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX}" >> $(CONFIG_FILE) @echo "Done." .PHONY: run run: - docker compose up \ No newline at end of file + docker compose up + +.PHONY: push +push: + docker push $(REGISTRY)/$(OWNER)/$(IMAGE):$(TAG) \ No newline at end of file