-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 397c68b
Showing
5 changed files
with
196 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
data/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
data/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
os: linux | ||
dist: trusty | ||
cache: false | ||
sudo: required | ||
language: bash | ||
services: docker | ||
env: | ||
matrix: | ||
- ARCH=x86_64 PUID=1000 PGID=1000 | ||
# - ARCH=armhf PUID=1001 PGID=1001 | ||
global: | ||
install: true | ||
before_script: | ||
- docker --version | ||
- make --version | ||
script: | ||
- make ARCH=${ARCH} PUID=${PUID} PGID=${PGID} build test | ||
after_success: | ||
- docker login -u ${DOCKER_USER} -p ${DOCKER_PASS} | ||
- make ARCH=${ARCH} push | ||
after_script: | ||
- docker logout | ||
- make clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
ARG ARCH=frommakefile | ||
ARG DOCKERSRC=frommakefile | ||
ARG USERNAME=frommakefile | ||
# | ||
FROM ${USERNAME}/${DOCKERSRC}:${ARCH} | ||
# | ||
ARG PUID=1000 | ||
ARG PGID=1000 | ||
# | ||
RUN set -xe \ | ||
&& echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \ | ||
&& echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \ | ||
&& apk add --no-cache --purge -uU \ | ||
curl icu-libs unzip zlib-dev musl \ | ||
mesa-gl mesa-dri-swrast \ | ||
libreoffice libreoffice-base libreoffice-lang-uk \ | ||
ttf-freefont ttf-opensans ttf-font-awesome ttf-ubuntu-font-family ttf-inconsolata \ | ||
libstdc++ dbus-x11 \ | ||
&& rm -rf /var/cache/apk/* /tmp/* | ||
# | ||
VOLUME /home/alpine/ | ||
# | ||
USER alpine | ||
WORKDIR /home/alpine/ | ||
# | ||
ENTRYPOINT ["/usr/bin/libreoffice"] | ||
# ENTRYPOINT ["/bin/bash"] | ||
# ENTRYPOINT ["/init"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
# {{{ -- meta | ||
|
||
HOSTARCH := x86_64# on travis.ci | ||
ARCH := $(shell uname -m | sed "s_armv7l_armhf_")# armhf/x86_64 auto-detect on build and run | ||
OPSYS := alpine | ||
SHCOMMAND := /bin/bash | ||
SVCNAME := libreoffice | ||
USERNAME := woahbase | ||
|
||
PUID := $(shell id -u) | ||
PGID := $(shell id -g)# gid 100(users) usually pre exists | ||
|
||
DOCKERSRC := $(OPSYS)-openjdk8# | ||
DOCKEREPO := $(OPSYS)-$(SVCNAME) | ||
IMAGETAG := $(USERNAME)/$(DOCKEREPO):$(ARCH) | ||
|
||
CNTNAME := $(SVCNAME)# name for container name : docker_name, hostname : name | ||
|
||
# -- }}} | ||
|
||
# {{{ -- flags | ||
|
||
BUILDFLAGS := --rm --force-rm --compress -f $(CURDIR)/Dockerfile_$(ARCH) -t $(IMAGETAG) \ | ||
--build-arg ARCH=$(ARCH) \ | ||
--build-arg DOCKERSRC=$(DOCKERSRC) \ | ||
--build-arg USERNAME=$(USERNAME) \ | ||
--build-arg PUID=$(PUID) \ | ||
--build-arg PGID=$(PGID) \ | ||
--label org.label-schema.build-date=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ") \ | ||
--label org.label-schema.name=$(DOCKEREPO) \ | ||
--label org.label-schema.schema-version="1.0" \ | ||
--label org.label-schema.url="https://woahbase.online/" \ | ||
--label org.label-schema.usage="https://woahbase.online/\#/images/$(DOCKEREPO)" \ | ||
--label org.label-schema.vcs-ref=$(shell git rev-parse --short HEAD) \ | ||
--label org.label-schema.vcs-url="https://github.com/$(USERNAME)/$(DOCKEREPO)" \ | ||
--label org.label-schema.vendor=$(USERNAME) | ||
|
||
CACHEFLAGS := --no-cache=true --pull | ||
|
||
MOUNTFLAGS := -v $(CURDIR)/data:/home/alpine \ | ||
-v /tmp/.X11-unix:/tmp/.X11-unix \ | ||
# -v /var/run/dbus:/var/run/dbus \ | ||
# -v /dev/shm:/dev/shm# mount in local | ||
# -v /dev/dri:/dev/dri | ||
|
||
NAMEFLAGS := --name docker_$(CNTNAME) --hostname $(CNTNAME) | ||
OTHERFLAGS := # -v /etc/hosts:/etc/hosts:ro -v /etc/localtime:/etc/localtime:ro # -e TZ=Asia/Kolkata | ||
PORTFLAGS := # --net=host | ||
PROXYFLAGS := --build-arg http_proxy=$(http_proxy) --build-arg https_proxy=$(https_proxy) --build-arg no_proxy=$(no_proxy) | ||
|
||
RUNFLAGS := -e PGID=$(PGID) -e PUID=$(PUID) \ | ||
-c 512 -m 2096m \ | ||
-e DISPLAY=unix$(DISPLAY) \ | ||
-v /usr/share/fonts:/usr/share/fonts:ro | ||
#-e PULSE_SERVER=localhost \ | ||
# -- }}} | ||
|
||
# {{{ -- docker targets | ||
|
||
all : run | ||
|
||
build : | ||
echo "Building for $(ARCH) from $(HOSTARCH)"; | ||
if [ "$(ARCH)" != "$(HOSTARCH)" ]; then make regbinfmt ; fi; | ||
docker build $(BUILDFLAGS) $(CACHEFLAGS) $(PROXYFLAGS) . | ||
|
||
clean : | ||
docker images | awk '(NR>1) && ($$2!~/none/) {print $$1":"$$2}' | grep "$(USERNAME)/$(DOCKEREPO)" | xargs -n1 docker rmi | ||
|
||
logs : | ||
docker logs -f docker_$(CNTNAME) | ||
|
||
pull : | ||
docker pull $(IMAGETAG) | ||
|
||
push : | ||
docker push $(IMAGETAG); \ | ||
if [ "$(ARCH)" = "$(HOSTARCH)" ]; \ | ||
then \ | ||
LATESTTAG=$$(echo $(IMAGETAG) | sed 's/:$(ARCH)/:latest/'); \ | ||
docker tag $(IMAGETAG) $${LATESTTAG}; \ | ||
docker push $${LATESTTAG}; \ | ||
fi; | ||
|
||
restart : | ||
docker ps -a | grep 'docker_$(CNTNAME)' -q && docker restart docker_$(CNTNAME) || echo "Service not running."; | ||
|
||
rm : stop | ||
docker rm -f docker_$(CNTNAME) | ||
|
||
run : | ||
docker run --rm -it $(NAMEFLAGS) $(RUNFLAGS) $(PORTFLAGS) $(MOUNTFLAGS) $(OTHERFLAGS) $(IMAGETAG) | ||
|
||
help : | ||
docker run --rm -it $(NAMEFLAGS) $(RUNFLAGS) $(PORTFLAGS) $(MOUNTFLAGS) $(OTHERFLAGS) $(IMAGETAG) --help | ||
|
||
writer : | ||
docker run --rm -it $(NAMEFLAGS) $(RUNFLAGS) $(PORTFLAGS) $(MOUNTFLAGS) $(OTHERFLAGS) $(IMAGETAG) --writer --nologo | ||
|
||
calc : | ||
docker run --rm -it $(NAMEFLAGS) $(RUNFLAGS) $(PORTFLAGS) $(MOUNTFLAGS) $(OTHERFLAGS) $(IMAGETAG) --calc --nologo | ||
|
||
draw : | ||
docker run --rm -it $(NAMEFLAGS) $(RUNFLAGS) $(PORTFLAGS) $(MOUNTFLAGS) $(OTHERFLAGS) $(IMAGETAG) --draw --nologo | ||
|
||
impress : | ||
docker run --rm -it $(NAMEFLAGS) $(RUNFLAGS) $(PORTFLAGS) $(MOUNTFLAGS) $(OTHERFLAGS) $(IMAGETAG) --impress --nologo | ||
|
||
base : | ||
docker run --rm -it $(NAMEFLAGS) $(RUNFLAGS) $(PORTFLAGS) $(MOUNTFLAGS) $(OTHERFLAGS) $(IMAGETAG) --base --nologo | ||
|
||
global : | ||
docker run --rm -it $(NAMEFLAGS) $(RUNFLAGS) $(PORTFLAGS) $(MOUNTFLAGS) $(OTHERFLAGS) $(IMAGETAG) --global --nologo | ||
|
||
math : | ||
docker run --rm -it $(NAMEFLAGS) $(RUNFLAGS) $(PORTFLAGS) $(MOUNTFLAGS) $(OTHERFLAGS) $(IMAGETAG) --math --nologo | ||
|
||
web : | ||
docker run --rm -it $(NAMEFLAGS) $(RUNFLAGS) $(PORTFLAGS) $(MOUNTFLAGS) $(OTHERFLAGS) $(IMAGETAG) --web --nologo | ||
|
||
rshell : | ||
docker exec -u root -it docker_$(CNTNAME) $(SHCOMMAND) | ||
|
||
shell : | ||
docker exec -it docker_$(CNTNAME) $(SHCOMMAND) | ||
|
||
stop : | ||
docker stop -t 2 docker_$(CNTNAME) | ||
|
||
test : # test armhf on real devices | ||
if [ "$(HOSTARCH)" = "armhf" ] || [ "$(ARCH)" != "armhf" ]; then \ | ||
docker run --rm -it $(NAMEFLAGS) $(IMAGETAG) "--version"; \ | ||
fi; | ||
|
||
# -- }}} | ||
|
||
# {{{ -- other targets | ||
|
||
regbinfmt : | ||
docker run --rm --privileged multiarch/qemu-user-static:register --reset | ||
|
||
# -- }}} |