Skip to content

Commit

Permalink
Add FMS base package.
Browse files Browse the repository at this point in the history
  • Loading branch information
neprune committed Feb 25, 2025
1 parent b982387 commit 1f76cf5
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/fms-base/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/Dockerfile*
/Makefile
bin/build.sh
bin/configure.py
Empty file added packages/fms-base/bin/.gitkeep
Empty file.
36 changes: 36 additions & 0 deletions packages/fms-base/conf/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{% if arch %}
FROM base-builder:{{ codename }}-{{ arch }}-latest
{% else %}
FROM base-builder:{{ codename }}-latest
{% endif %}
LABEL maintainer="{{ vendor}} <{{ vendor_email }}>"

RUN apt-get -qq update && apt-get -qq -y install git perl postgresql

WORKDIR /home/builder
USER builder

ARG TAG={{ version }}
RUN git clone --recursive https://github.com/mysociety/fixmystreet.git
RUN git checkout v{{ version }}

WORKDIR /home/builder/fixmystreet

USER root
RUN cp conf/packages.docker /opt/
RUN xargs -a "/opt/packages.docker" apt-get -qq -y install >/dev/null

USER builder
RUN ./script/bootstrap
RUN fpm -s dir -t deb \
--vendor "mySociety" \
--maintainer "mySociety <sysadmin@mysociety.org>" \
--version "{{ version }}" \
--iteration "ms1" \
--architecture "native" \
--url "https://github.com/mysociety/fixmystreet" \
--description "mysociety's package containing build artefacts to speed up the process of deploying new FixMyStreet servers." \
-n "fms-base" \
./local/=/data/fms_deps/perl_modules

CMD ["sh", "-c", "/bin/mv *.deb ../deb/{{ codename }}"]
72 changes: 72 additions & 0 deletions packages/fms-base/conf/Makefile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
.PHONEY: all
{% if shared_package %}
all: build

build:
@./bin/build.sh

{% else %}
DISTRIBUTIONS := {{ codenames | join(' ') }}

all: $(DISTRIBUTIONS)

.PHONY: $(DISTRIBUTIONS)
$(DISTRIBUTIONS):
@echo "==> Building $@..."
@./bin/build.sh $@

{% if can_target_arch %}
ARCHITECTURES := {{ architectures | join(' ') }}
# Handle 'make all-all'
.PHONY: all-all
all-all:
@for dist in $(DISTRIBUTIONS); do \
for arch in $(ARCHITECTURES); do \
echo "==> Building $$dist for $$arch..."; \
./bin/build.sh $$dist $$arch; \
done; \
done

# 'make <distribution>-<architecture>'
.PHONY: $(foreach d,$(DISTRIBUTIONS),$(foreach a,$(ARCHITECTURES),$(d)-$(a)))
$(foreach d,$(DISTRIBUTIONS),$(foreach a,$(ARCHITECTURES),$(d)-$(a))):
@dist=$(shell echo $@ | cut -d- -f1); \
arch=$(shell echo $@ | cut -d- -f2); \
echo "==> Building $$dist for $$arch..."; \
./bin/build.sh $$dist $$arch

# Handle 'make <distribution>-all'
.PHONY: $(foreach d,$(DISTRIBUTIONS),$(d)-all)
$(foreach d,$(DISTRIBUTIONS),$(d)-all):
@dist=$(shell echo $@ | cut -d- -f1); \
for arch in $(ARCHITECTURES); do \
echo "==> Building $$dist for $$arch..."; \
./bin/build.sh $$dist $$arch; \
done

# Handle 'make all-<architecture>'
.PHONY: $(foreach d,$(DISTRIBUTIONS),$(d)-all)
$(foreach a,$(ARCHITECTURES),all-$(a)):
@arch=$(shell echo $@ | cut -d- -f2); \
for dist in $(DISTRIBUTIONS); do \
echo "==> Building $$dist for $$arch..."; \
./bin/build.sh $$dist $$arch; \
done
{% endif %}
{% endif %}

.PHONEY: clean-deb clean-images clean-config clean
clean-deb:
@echo "==> Removing old artefacts..."
@rm -fr deb/* || echo "==> No artefacts found."

clean-images:
@echo "==> Removing old Docker images..."
@docker image ls -q $(shell basename $(shell pwd))-builder | xargs docker rmi -f 2>/dev/null || echo "==> No images found."

clean-config:
@echo "==> Cleaning up locally generated config..."
@rm -f Dockerfile*
@rm -f Makefile

clean: clean-deb clean-images clean-config
9 changes: 9 additions & 0 deletions packages/fms-base/conf/conf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
iteration: ms1
version: 6.0
can_target_arch: true
skip_codenames:
- buster
- bionic
- focal
- jammy
5 changes: 5 additions & 0 deletions packages/fms-base/configure
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

[ -f ../../.venv/packaging/bin/activate ] && . ../../.venv/packaging/bin/activate

./bin/configure.py
Empty file added packages/fms-base/deb/.gitkeep
Empty file.

0 comments on commit 1f76cf5

Please sign in to comment.