]> Untitled Git - lemmy.git/blob - docker/prod/deploy.sh
Isomorphic docker (#1124)
[lemmy.git] / docker / prod / deploy.sh
1 #!/bin/sh
2 set -e
3 git checkout main
4
5 # Import translations
6 git fetch weblate
7 git merge weblate/main
8
9 # Creating the new tag
10 new_tag="$1"
11 third_semver=$(echo $new_tag | cut -d "." -f 3)
12
13 # Setting the version on the front end
14 cd ../../
15 # Setting the version on the backend
16 echo "pub const VERSION: &str = \"$new_tag\";" > "src/version.rs"
17 git add "src/version.rs"
18 # Setting the version for Ansible
19 echo $new_tag > "ansible/VERSION"
20 git add "ansible/VERSION"
21
22 cd docker/prod || exit
23
24 # Changing the docker-compose prod
25 sed -i "s/dessalines\/lemmy:.*/dessalines\/lemmy:$new_tag/" ../prod/docker-compose.yml
26 sed -i "s/dessalines\/lemmy:.*/dessalines\/lemmy:$new_tag/" ../../ansible/templates/docker-compose.yml
27 sed -i "s/dessalines\/lemmy:v.*/dessalines\/lemmy:$new_tag/" ../travis/docker_push.sh
28 git add ../prod/docker-compose.yml
29 git add ../../ansible/templates/docker-compose.yml
30 git add ../travis/docker_push.sh
31
32 # The commit
33 git commit -m"Version $new_tag"
34 git tag $new_tag
35
36 # Now doing the building on travis, but leave this in for when you need to do an arm build
37
38 # export COMPOSE_DOCKER_CLI_BUILD=1
39 # export DOCKER_BUILDKIT=1
40
41 # # Rebuilding docker
42 # if [ $third_semver -eq 0 ]; then
43 #   # TODO get linux/arm/v7 build working
44 #   # Build for Raspberry Pi / other archs too
45 #   docker buildx build --platform linux/amd64,linux/arm64 ../../ \
46 #     --file Dockerfile \
47 #     --tag dessalines/lemmy:$new_tag \
48 #     --push
49 # else
50 #   docker buildx build --platform linux/amd64 ../../ \
51 #     --file Dockerfile \
52 #     --tag dessalines/lemmy:$new_tag \
53 #     --push
54 # fi
55
56 # Push
57 git push origin $new_tag
58 git push
59
60 # Pushing to any ansible deploys
61 # cd ../../../lemmy-ansible || exit
62 # ansible-playbook -i prod playbooks/site.yml --vault-password-file vault_pass