2015-12-12 22:42:37 +01:00
|
|
|
APP_ROOT := /var/lib/airport
|
2012-01-19 02:01:00 +01:00
|
|
|
AIRPORT_REPO ?= https://bitbucket.org/marduk/airport
|
2015-12-12 22:42:37 +01:00
|
|
|
AIRPORT_BRANCH ?= stable
|
2018-10-27 20:18:42 +02:00
|
|
|
PGVER := 10
|
2018-12-06 02:06:13 +01:00
|
|
|
repo := $(CHROOT)/$(APP_ROOT)
|
|
|
|
etc_issue := $(CHROOT)/etc/issue
|
|
|
|
services := $(wildcard *.service)
|
|
|
|
service_targets := $(patsubst %,$(CHROOT)/etc/systemd/system/%,$(services))
|
2012-01-19 02:01:00 +01:00
|
|
|
|
2018-12-06 02:06:13 +01:00
|
|
|
$(CHROOT)/etc/systemd/system/%.service: %.service
|
|
|
|
cp $< $@
|
|
|
|
RUN systemctl enable $<
|
|
|
|
|
|
|
|
$(etc_issue): issue
|
|
|
|
cp $< $@
|
2012-01-09 22:21:06 +01:00
|
|
|
|
2018-12-06 02:06:13 +01:00
|
|
|
$(repo):
|
|
|
|
hg clone -u $(AIRPORT_BRANCH) $(AIRPORT_REPO) $@
|
2012-01-09 22:21:06 +01:00
|
|
|
|
2018-12-06 02:06:13 +01:00
|
|
|
preinstall:
|
|
|
|
|
|
|
|
postinstall: settings.py issue nginx.conf $(service_targets) $(repo) $(etc_issue)
|
2018-10-27 20:04:00 +02:00
|
|
|
RUN eselect postgresql set $(PGVER)
|
2012-09-12 21:17:40 +02:00
|
|
|
rm -rf $(CHROOT)/var/lib/postgresql/$(PGVER)
|
2018-10-27 20:04:00 +02:00
|
|
|
RUN bash -c "echo y |$(EMERGE) --config postgresql:$(PGVER)"
|
|
|
|
RUN systemctl enable postgresql-$(PGVER)
|
|
|
|
RUN $(EMERGE) --oneshot --noreplace $(USEPKG) dev-python/setuptools dev-python/virtualenv
|
2012-01-09 22:21:06 +01:00
|
|
|
rm -rf $(CHROOT)/$(APP_ROOT)
|
2013-10-12 16:13:51 +02:00
|
|
|
hg clone -u $(AIRPORT_BRANCH) $(AIRPORT_REPO) $(CHROOT)/$(APP_ROOT)
|
2014-01-11 16:05:38 +01:00
|
|
|
chroot $(CHROOT) virtualenv -p /usr/bin/python3 $(APP_ROOT)
|
2018-12-06 02:06:13 +01:00
|
|
|
RUN $(APP_ROOT)/bin/pip install -r $(APP_ROOT)/requirements.txt
|
|
|
|
RUN $(APP_ROOT)/bin/pip install psycopg2 uwsgi
|
2018-10-27 20:04:00 +02:00
|
|
|
COPY settings.py /$(APP_ROOT)/djangoproject/djangoproject
|
|
|
|
RUN id -u airport >/dev/null || RUN useradd -d $(APP_ROOT) -M -U -G postgres airport
|
|
|
|
RUN chown -R airport:airport $(APP_ROOT)
|
2014-01-11 16:05:38 +01:00
|
|
|
ifdef AIRPORT_SERIES
|
2015-12-12 22:42:37 +01:00
|
|
|
cat settings_$(AIRPORT_SERIES).py >> $(CHROOT)/$(APP_ROOT)/djangoproject/djangoproject/settings.py
|
2018-10-27 20:04:00 +02:00
|
|
|
RUN cp /$(APP_ROOT)/djangoproject/airport/fixtures/$(AIRPORT_SERIES).json \
|
|
|
|
/$(APP_ROOT)/djangoproject/airport/fixtures/initial_data.json
|
2014-01-11 16:05:38 +01:00
|
|
|
endif
|
2013-09-27 16:34:15 +02:00
|
|
|
$(M4) -D HOSTNAME=$(HOSTNAME) nginx.conf > $(CHROOT)/etc/nginx/nginx.conf
|
2018-10-27 20:04:00 +02:00
|
|
|
RUN gpasswd -a nginx airport
|
|
|
|
RUN systemctl enable airport-wsgi.service
|
|
|
|
RUN systemctl enable airport-gameserver.service
|
|
|
|
RUN $(EMERGE) --depclean --with-bdeps=n
|
2012-01-09 22:21:06 +01:00
|
|
|
|
|
|
|
|
|
|
|
clean:
|
|
|
|
|