Skip to content

Commit

Permalink
Update Makefile so it generates ssl certs automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
abinoam committed Nov 11, 2024
1 parent 51ad8bf commit 03fcf21
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
IMAGE:=sameersbn/redmine
CERTS_DIR=certs
CERT_FILES=$(CERTS_DIR)/redmine.crt $(CERTS_DIR)/dhparam.pem

.PHONY: test-release generate-certs clean

all: build

help:
Expand All @@ -14,15 +19,36 @@ help:
build:
@docker build --tag=$(IMAGE) .

test-release:

test-release: generate-certs
@echo Clean old run
sudo rm -rf /srv/docker/redmine/
sudo mkdir -p /srv/docker/redmine/redmine
sudo cp -rf certs /srv/docker/redmine/redmine/
sudo cp -rf $(CERTS_DIR) /srv/docker/redmine/redmine/
docker compose down
docker compose build
docker compose up

generate-certs: $(CERT_FILES)

$(CERTS_DIR):
mkdir -p $(CERTS_DIR)

$(CERTS_DIR)/redmine.key: | $(CERTS_DIR)
openssl genrsa -out $(CERTS_DIR)/redmine.key 2048

$(CERTS_DIR)/redmine.csr: $(CERTS_DIR)/redmine.key
openssl req -new -key $(CERTS_DIR)/redmine.key -out $(CERTS_DIR)/redmine.csr

$(CERTS_DIR)/redmine.crt: $(CERTS_DIR)/redmine.csr $(CERTS_DIR)/redmine.key
openssl x509 -req -days 365 -in $(CERTS_DIR)/redmine.csr -signkey $(CERTS_DIR)/redmine.key -out $(CERTS_DIR)/redmine.crt

$(CERTS_DIR)/dhparam.pem: | $(CERTS_DIR)
openssl dhparam -out $(CERTS_DIR)/dhparam.pem 2048

clean:
rm -rf $(CERTS_DIR)

release:
./make_release.sh
@echo "Open https://github.com/sameersbn/docker-redmine/releases and Draft new release"
Expand Down

0 comments on commit 03fcf21

Please sign in to comment.