bluesky-pds-docker/Makefile
2024-12-01 19:15:39 -05:00

37 lines
No EOL
1.5 KiB
Makefile

IMAGE_NAME=bluesky-pds
IMAGE_TAG=0.4.74
export DOCKER_BUILDKIT=1
# export BUILDKIT_PROGRESS=plain
.PHONY: build
build:
docker build --tag $(IMAGE_NAME):$(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"
.PHONY: generate-secrets
generate-secrets:
@echo "Generating secrets..."
$(eval GENERATE_SECURE_SECRET_CMD=openssl rand --hex 16)
$(eval GENERATE_K256_PRIVATE_KEY_CMD=openssl ecparam --name secp256k1 --genkey --noout --outform DER | tail --bytes=+8 | head --bytes=32 | xxd --plain --cols 32)
$(eval PDS_ADMIN_PASSWORD=$(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}))
@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
@echo "Done."
.PHONY: run
run:
docker compose up