Skip to content

Commit

Permalink
Merge pull request #22 from anyproto/18-updating-using-make-update-re…
Browse files Browse the repository at this point in the history
…writes-configuration-file

docker-generateconfig fix
  • Loading branch information
fb929 committed Feb 14, 2024
2 parents cf1ecd7 + 3028f56 commit ff0327d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Dockerfile-generateconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ FROM golang:1.21.6-alpine3.19 as generator
RUN apk add --no-cache bash yq
RUN go install github.com/anyproto/any-sync-tools/anyconf@latest
WORKDIR /opt/generateconfig
COPY ./storage/docker-generateconfig/ .
COPY --chmod=777 docker-generateconfig/generate_config.sh .env .
RUN ./generate_config.sh

FROM alpine:3.18.4
RUN apk add --no-cache bash yq perl python3 py3-yaml
RUN apk add --no-cache bash yq perl python3 py3-yaml rsync
WORKDIR /opt/processing
COPY docker-generateconfig/etc/ tmp-etc/
COPY --chmod=777 docker-generateconfig/processing.sh .
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
include .env

generate_config:
mkdir -p ./storage/docker-generateconfig/
docker build -t generateconfig -f Dockerfile-generateconfig .
docker run --rm -v ${CURDIR}/etc:/opt/processing/etc --name any-sync-generator generateconfig
docker run --rm --volume ${CURDIR}/etc:/opt/processing/etc --volume ${CURDIR}/storage/docker-generateconfig:/opt/processing/docker-generateconfig --name any-sync-generator generateconfig

start: generate_config
docker compose up -d
Expand All @@ -14,7 +15,7 @@ stop:
docker compose stop

clean:
docker system prune --all
docker system prune --all --volumes

pull:
docker compose pull
Expand Down
3 changes: 3 additions & 0 deletions docker-generateconfig/processing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@ placeholders=(
for placeholder in "${placeholders[@]}"; do
perl -i -pe "s|%${placeholder}%|${!placeholder}|g" "${network_file}" "${dest_path}/"/*/*.yml
done

# save generated configs
rsync -a --delete generateconfig/ /opt/processing/docker-generateconfig

0 comments on commit ff0327d

Please sign in to comment.