Artifact 9e10ba9819cab8dd339938835eece78f6b0324d86a68a63563ae0151b5d0aa4d:
- File container/Makefile — part of check-in [7890006be4] at 2023-07-14 06:26:47 on branch trunk — Switched build commands over to the shorter versions now that buildx is the default. (user: tangent size: 2301)
0000: 23 20 57 65 20 61 73 73 75 6d 65 20 77 65 27 76 # We assume we'v 0010: 65 20 62 65 65 6e 20 63 68 65 63 6b 65 64 20 6f e been checked o 0020: 75 74 20 69 6e 74 6f 20 61 20 70 61 72 61 6c 6c ut into a parall 0030: 65 6c 20 64 69 72 65 63 74 6f 72 79 20 74 6f 20 el directory to 0040: 74 68 65 0a 23 20 75 70 73 74 72 65 61 6d 20 46 the.# upstream F 0050: 6f 73 73 69 6c 20 74 72 75 6e 6b 20 73 6f 75 72 ossil trunk sour 0060: 63 65 73 2e 0a 55 50 53 54 52 45 41 4d 20 3a 3d ces..UPSTREAM := 0070: 20 2e 2e 2f 2e 2e 2f 74 72 75 6e 6b 0a 0a 23 20 ../../trunk..# 0080: 47 65 74 20 75 70 73 74 72 65 61 6d 27 73 20 63 Get upstream's c 0090: 75 72 72 65 6e 74 20 63 6f 6d 6d 69 74 20 49 44 urrent commit ID 00a0: 20 70 72 65 66 69 78 20 74 6f 20 75 73 65 20 61 prefix to use a 00b0: 73 20 61 20 75 6e 69 71 75 65 20 76 65 72 73 69 s a unique versi 00c0: 6f 6e 0a 23 20 74 61 67 20 66 6f 72 20 6f 75 72 on.# tag for our 00d0: 20 62 75 69 6c 64 73 2e 20 20 4e 6f 74 65 20 74 builds. Note t 00e0: 68 61 74 20 69 74 20 69 73 6e 27 74 20 2a 6f 75 hat it isn't *ou 00f0: 72 2a 20 63 6f 6d 6d 69 74 20 49 44 20 77 65 20 r* commit ID we 0100: 63 61 72 65 20 61 62 6f 75 74 3a 0a 23 20 77 68 care about:.# wh 0110: 65 6e 20 73 6f 6d 65 6f 6e 65 20 63 6f 6d 70 61 en someone compa 0120: 72 65 73 20 74 68 65 73 65 20 76 65 72 73 69 6f res these versio 0130: 6e 73 20 6f 6e 20 6f 75 72 20 44 6f 63 6b 65 72 ns on our Docker 0140: 20 48 75 62 20 70 61 67 65 20 74 6f 20 74 68 6f Hub page to tho 0150: 73 65 0a 23 20 6f 66 20 46 6f 73 73 69 6c 2c 20 se.# of Fossil, 0160: 74 68 65 79 20 64 6f 6e 27 74 20 77 61 6e 74 20 they don't want 0170: 74 6f 20 62 6f 75 6e 63 65 20 74 68 72 6f 75 67 to bounce throug 0180: 68 20 74 68 65 20 69 6e 64 69 72 65 63 74 69 6f h the indirectio 0190: 6e 20 6f 66 20 74 68 69 73 0a 23 20 72 65 70 6f n of this.# repo 01a0: 27 73 20 76 65 72 73 69 6f 6e 20 6e 75 6d 62 65 's version numbe 01b0: 72 69 6e 67 20 73 63 68 65 6d 65 2e 0a 46 53 4c ring scheme..FSL 01c0: 56 45 52 20 3a 3d 20 24 28 73 68 65 6c 6c 20 63 VER := $(shell c 01d0: 75 74 20 2d 63 31 2d 31 32 20 3c 20 24 28 55 50 ut -c1-12 < $(UP 01e0: 53 54 52 45 41 4d 29 2f 6d 61 6e 69 66 65 73 74 STREAM)/manifest 01f0: 2e 75 75 69 64 29 0a 46 53 4c 52 45 4c 20 3a 3d .uuid).FSLREL := 0200: 20 24 28 73 68 65 6c 6c 20 63 64 20 24 28 55 50 $(shell cd $(UP 0210: 53 54 52 45 41 4d 29 20 3b 20 66 6f 73 73 69 6c STREAM) ; fossil 0220: 20 74 61 67 20 6c 73 20 7c 20 67 72 65 70 20 2d tag ls | grep - 0230: 45 20 27 76 65 72 73 69 6f 6e 2d 5c 64 27 20 7c E 'version-\d' | 0240: 20 74 61 69 6c 20 2d 31 29 0a 0a 23 20 54 68 65 tail -1)..# The 0250: 20 6c 69 73 74 20 6f 66 20 70 6c 61 74 66 6f 72 list of platfor 0260: 6d 73 20 77 65 20 62 75 69 6c 64 20 74 68 65 20 ms we build the 0270: 63 6f 6e 74 61 69 6e 65 72 20 66 6f 72 2e 20 20 container for. 0280: 49 74 20 73 68 6f 75 6c 64 20 63 6f 76 65 72 20 It should cover 0290: 39 39 25 0a 23 20 6f 66 20 61 6c 6c 20 70 72 61 99%.# of all pra 02a0: 63 74 69 63 61 6c 20 75 73 65 20 63 61 73 65 73 ctical use cases 02b0: 2e 20 20 49 74 27 73 20 73 70 6c 69 74 20 73 6f . It's split so 02c0: 20 77 65 20 64 6f 20 6e 61 74 69 76 65 20 41 52 we do native AR 02d0: 4d 20 43 50 55 20 62 75 69 6c 64 73 0a 23 20 6c M CPU builds.# l 02e0: 6f 63 61 6c 6c 79 20 61 6e 64 20 78 38 36 20 65 ocally and x86 e 02f0: 6c 73 65 77 68 65 72 65 2c 20 73 6f 20 77 65 20 lsewhere, so we 0300: 64 6f 6e 27 74 20 74 61 6b 65 20 74 68 65 20 51 don't take the Q 0310: 45 4d 55 20 73 70 65 65 64 20 68 69 74 20 6f 66 EMU speed hit of 0320: 0a 23 20 63 72 6f 73 73 2d 63 6f 6d 70 69 6c 61 .# cross-compila 0330: 74 69 6f 6e 2e 20 20 42 6f 6e 75 73 3a 20 77 65 tion. Bonus: we 0340: 20 72 6f 75 67 68 6c 79 20 64 6f 75 62 6c 65 20 roughly double 0350: 6f 75 72 20 62 75 69 6c 64 20 63 6f 72 65 73 2e our build cores. 0360: 0a 41 52 4d 5f 50 4c 41 54 46 4f 52 4d 53 20 3a .ARM_PLATFORMS : 0370: 3d 20 6c 69 6e 75 78 2f 61 72 6d 36 34 2c 6c 69 = linux/arm64,li 0380: 6e 75 78 2f 61 72 6d 2f 76 37 0a 58 38 36 5f 50 nux/arm/v7.X86_P 0390: 4c 41 54 46 4f 52 4d 53 20 3a 3d 20 6c 69 6e 75 LATFORMS := linu 03a0: 78 2f 61 6d 64 36 34 2c 6c 69 6e 75 78 2f 33 38 x/amd64,linux/38 03b0: 36 0a 58 38 36 5f 42 55 49 4c 44 5f 48 4f 53 54 6.X86_BUILD_HOST 03c0: 20 3a 3d 20 78 38 36 0a 42 55 49 4c 44 45 52 20 := x86.BUILDER 03d0: 3a 3d 20 66 6f 73 73 69 6c 2d 61 64 64 6f 6e 73 := fossil-addons 03e0: 2d 62 75 69 6c 64 65 72 0a 0a 23 20 49 6d 61 67 -builder..# Imag 03f0: 65 20 72 65 70 6f 20 70 72 65 66 69 78 20 74 6f e repo prefix to 0400: 20 75 73 65 20 66 6f 72 20 22 70 75 73 68 22 0a use for "push". 0410: 52 45 50 4f 55 53 45 52 3d 74 61 6e 67 65 6e 74 REPOUSER=tangent 0420: 73 6f 66 74 0a 54 41 47 50 46 58 3d 24 28 52 45 soft.TAGPFX=$(RE 0430: 50 4f 55 53 45 52 29 2f 0a 0a 23 20 43 72 65 61 POUSER)/..# Crea 0440: 74 65 20 63 6f 6e 74 61 69 6e 65 72 20 69 6d 61 te container ima 0450: 67 65 2e 20 20 57 69 74 68 6f 75 74 20 6f 70 74 ge. Without opt 0460: 69 6f 6e 73 2c 20 63 72 65 61 74 65 73 20 61 20 ions, creates a 0470: 6c 6f 63 61 6c 0a 23 20 74 69 70 2d 6f 66 2d 74 local.# tip-of-t 0480: 72 75 6e 6b 20 62 75 69 6c 64 2e 0a 61 6c 6c 3a runk build..all: 0490: 20 62 75 69 6c 64 0a 09 64 6f 63 6b 65 72 20 62 build..docker b 04a0: 75 69 6c 64 20 5c 0a 09 09 2d 2d 70 6c 61 74 66 uild \...--platf 04b0: 6f 72 6d 20 24 28 41 52 4d 5f 50 4c 41 54 46 4f orm $(ARM_PLATFO 04c0: 52 4d 53 29 2c 24 28 58 38 36 5f 50 4c 41 54 46 RMS),$(X86_PLATF 04d0: 4f 52 4d 53 29 20 5c 0a 09 09 2d 2d 62 75 69 6c ORMS) \...--buil 04e0: 64 65 72 20 24 28 42 55 49 4c 44 45 52 29 20 5c der $(BUILDER) \ 04f0: 0a 09 09 2d 2d 62 75 69 6c 64 2d 61 72 67 20 55 ...--build-arg U 0500: 49 44 3d 31 30 30 30 20 5c 0a 09 09 2d 2d 62 75 ID=1000 \...--bu 0510: 69 6c 64 2d 61 72 67 20 46 53 4c 56 45 52 3d 24 ild-arg FSLVER=$ 0520: 28 46 53 4c 56 45 52 29 20 5c 0a 09 09 2d 2d 74 (FSLVER) \...--t 0530: 61 67 20 24 28 54 41 47 50 46 58 29 66 6f 73 73 ag $(TAGPFX)foss 0540: 69 6c 3a 24 28 46 53 4c 56 45 52 29 20 5c 0a 09 il:$(FSLVER) \.. 0550: 09 2d 2d 74 61 67 20 24 28 54 41 47 50 46 58 29 .--tag $(TAGPFX) 0560: 66 6f 73 73 69 6c 3a 6c 61 74 65 73 74 20 5c 0a fossil:latest \. 0570: 09 09 24 28 44 42 46 4c 41 47 53 29 20 24 28 55 ..$(DBFLAGS) $(U 0580: 50 53 54 52 45 41 4d 29 0a 0a 23 20 43 72 65 61 PSTREAM)..# Crea 0590: 74 65 20 74 68 65 20 62 75 69 6c 64 20 63 6f 6e te the build con 05a0: 74 61 69 6e 65 72 20 69 66 20 69 74 20 64 6f 65 tainer if it doe 05b0: 73 6e 27 74 20 65 78 69 73 74 20 61 6c 72 65 61 sn't exist alrea 05c0: 64 79 2e 20 20 57 69 74 68 6f 75 74 0a 23 20 74 dy. Without.# t 05d0: 68 69 73 2c 20 77 65 20 63 61 6e 27 74 20 63 72 his, we can't cr 05e0: 65 61 74 65 20 6d 75 6c 74 69 2d 61 72 63 68 20 eate multi-arch 05f0: 63 6f 6e 74 61 69 6e 65 72 73 2e 20 20 49 66 20 containers. If 0600: 79 6f 75 20 64 6f 6e 27 74 20 6e 65 65 64 20 74 you don't need t 0610: 68 61 74 2c 0a 23 20 79 6f 75 20 63 61 6e 20 72 hat,.# you can r 0620: 65 76 65 72 74 20 74 6f 20 22 64 6f 63 6b 65 72 evert to "docker 0630: 20 62 75 69 6c 64 22 2e 0a 62 75 69 6c 64 3a 0a build"..build:. 0640: 09 40 69 66 20 21 20 64 6f 63 6b 65 72 20 62 75 .@if ! docker bu 0650: 69 6c 64 78 20 69 6e 73 70 65 63 74 20 24 28 42 ildx inspect $(B 0660: 55 49 4c 44 45 52 29 20 3e 20 2f 64 65 76 2f 6e UILDER) > /dev/n 0670: 75 6c 6c 20 32 3e 26 31 20 3b 20 74 68 65 6e 20 ull 2>&1 ; then 0680: 5c 0a 09 09 64 6f 63 6b 65 72 20 62 75 69 6c 64 \...docker build 0690: 78 20 63 72 65 61 74 65 20 5c 0a 09 09 09 2d 2d x create \....-- 06a0: 6e 61 6d 65 20 24 28 42 55 49 4c 44 45 52 29 20 name $(BUILDER) 06b0: 5c 0a 09 09 09 2d 2d 70 6c 61 74 66 6f 72 6d 20 \....--platform 06c0: 24 28 41 52 4d 5f 50 4c 41 54 46 4f 52 4d 53 29 $(ARM_PLATFORMS) 06d0: 20 3b 20 5c 0a 09 09 64 6f 63 6b 65 72 20 62 75 ; \...docker bu 06e0: 69 6c 64 78 20 63 72 65 61 74 65 20 5c 0a 09 09 ildx create \... 06f0: 09 2d 2d 61 70 70 65 6e 64 20 5c 0a 09 09 09 2d .--append \....- 0700: 2d 6e 61 6d 65 20 24 28 42 55 49 4c 44 45 52 29 -name $(BUILDER) 0710: 20 5c 0a 09 09 09 2d 2d 70 6c 61 74 66 6f 72 6d \....--platform 0720: 20 24 28 58 38 36 5f 50 4c 41 54 46 4f 52 4d 53 $(X86_PLATFORMS 0730: 29 20 5c 0a 09 09 09 73 73 68 3a 2f 2f 24 28 55 ) \....ssh://$(U 0740: 53 45 52 29 40 24 28 58 38 36 5f 42 55 49 4c 44 SER)@$(X86_BUILD 0750: 5f 48 4f 53 54 29 20 3b 20 5c 0a 09 66 69 0a 09 _HOST) ; \..fi.. 0760: 64 6f 63 6b 65 72 20 62 75 69 6c 64 78 20 69 6e docker buildx in 0770: 73 70 65 63 74 20 5c 0a 09 09 2d 2d 62 6f 6f 74 spect \...--boot 0780: 73 74 72 61 70 20 5c 0a 09 09 2d 2d 62 75 69 6c strap \...--buil 0790: 64 65 72 20 24 28 42 55 49 4c 44 45 52 29 20 3b der $(BUILDER) ; 07a0: 20 5c 0a 0a 6c 6f 67 69 6e 3a 0a 09 64 6f 63 6b \..login:..dock 07b0: 65 72 20 6c 6f 67 69 6e 20 2d 2d 75 73 65 72 6e er login --usern 07c0: 61 6d 65 20 24 28 52 45 50 4f 55 53 45 52 29 20 ame $(REPOUSER) 07d0: 64 6f 63 6b 65 72 2e 69 6f 0a 0a 23 20 43 75 73 docker.io..# Cus 07e0: 74 6f 6d 20 76 65 72 73 69 6f 6e 20 6f 66 20 22 tom version of " 07f0: 61 6c 6c 22 20 66 6f 72 20 70 75 73 68 69 6e 67 all" for pushing 0800: 20 74 68 65 20 62 75 69 6c 74 20 69 6d 61 67 65 the built image 0810: 20 75 70 20 74 6f 20 44 6f 63 6b 65 72 20 48 75 up to Docker Hu 0820: 62 0a 70 75 73 68 3a 20 61 6c 6c 0a 09 24 28 4d b.push: all..$(M 0830: 41 4b 45 29 20 44 42 46 4c 41 47 53 3d 2d 2d 70 AKE) DBFLAGS=--p 0840: 75 73 68 20 0a 0a 23 20 41 6c 74 65 72 6e 61 74 ush ..# Alternat 0850: 69 76 65 20 74 6f 20 22 70 75 73 68 22 20 66 6f ive to "push" fo 0860: 72 20 6d 61 6b 69 6e 67 20 72 65 6c 65 61 73 65 r making release 0870: 20 69 6d 61 67 65 73 0a 72 65 6c 65 61 73 65 3a images.release: 0880: 20 62 75 69 6c 64 0a 09 63 64 20 2e 2e 2f 2e 2e build..cd ../.. 0890: 2f 72 65 6c 65 61 73 65 20 3b 20 66 6f 73 73 69 /release ; fossi 08a0: 6c 20 75 70 64 61 74 65 20 72 65 6c 65 61 73 65 l update release 08b0: 0a 09 24 28 4d 41 4b 45 29 20 5c 0a 09 09 44 42 ..$(MAKE) \...DB 08c0: 46 4c 41 47 53 3d 2d 2d 70 75 73 68 20 5c 0a 09 FLAGS=--push \.. 08d0: 09 46 53 4c 56 45 52 3d 24 28 46 53 4c 52 45 4c .FSLVER=$(FSLREL 08e0: 29 20 5c 0a 09 09 55 50 53 54 52 45 41 4d 3d 2e ) \...UPSTREAM=. 08f0: 2e 2f 2e 2e 2f 72 65 6c 65 61 73 65 0a ./../release.