Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

Commit c3da1bf

Browse files
committed
Added Docker build
1 parent ae9010f commit c3da1bf

File tree

14 files changed

+330
-4
lines changed

14 files changed

+330
-4
lines changed

.gitignore

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.*.swp
2-
/.misc
3-
/bin
4-
/docker
5-
/dist
2+
dist/
3+
bin/
4+
buildtools/*/*

docker/Dockerfile

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
ARG VERSION=0.9
2+
3+
# 1. First reference the gearbox-base image.
4+
FROM gearboxworks/gearbox-base:alpine-3.11 as gearbox-base
5+
6+
# 2. Next reference the third party image.
7+
FROM composer:1.10.0
8+
ARG VERSION
9+
ARG GEARBOX_ENTRYPOINT
10+
ARG GEARBOX_ENTRYPOINT_ARGS
11+
USER root
12+
13+
# 3. Copy the build directory over from gearbox-base image.
14+
COPY --from=gearbox-base /etc/gearbox /etc/gearbox
15+
16+
# 4. Set up env variables.
17+
MAINTAINER Gearbox Team <team@gearbox.works>
18+
ENV GEARBOX_CONTAINER_NAME "docker-deploywp"
19+
ENV GEARBOX_CONTAINER_VERSION ${VERSION}
20+
ENV GEARBOX_ENTRYPOINT ${GEARBOX_ENTRYPOINT}
21+
ENV GEARBOX_ENTRYPOINT_ARGS ${GEARBOX_ENTRYPOINT_ARGS}
22+
LABEL gearbox.json='{"schema": "gear-1","meta": {"state": "production","organization": "gearboxworks","name": "deploywp","label": "Composer","maintainer": "Gearbox Team <team@gearbox.works>","class": "dev","refurl": "https://getcomposer.org/"},"build": {"ports": {},"run": "","args": "","env": {"COMPOSER_USER": "gearbox"},"network": "--network gearboxnet","volumes": "","restart": "--restart no"},"run": {"commands": {"default": "deploywp","deploywp": "deploywp"}},"project": {},"extensions": {},"versions": {"1.1.3": {"majorversion": "1.1","latest": false,"ref": "composer:1.1.3","base": "gearboxworks/gearbox-base:alpine-3.4"},"1.2.4": {"majorversion": "1.2","latest": false,"ref": "composer:1.2.4","base": "gearboxworks/gearbox-base:alpine-3.4"},"1.3.3": {"majorversion": "1.3","latest": false,"ref": "composer:1.3.3","base": "gearboxworks/gearbox-base:alpine-3.4"},"1.4.3": {"majorversion": "1.4","latest": false,"ref": "composer:1.4.3","base": "gearboxworks/gearbox-base:alpine-3.7"},"1.5.6": {"majorversion": "1.5","latest": false,"ref": "composer:1.5.6","base": "gearboxworks/gearbox-base:alpine-3.7"},"1.6.5": {"majorversion": "1.6","latest": false,"ref": "composer:1.6.5","base": "gearboxworks/gearbox-base:alpine-3.8"},"1.7.3": {"majorversion": "1.7","latest": false,"ref": "composer:1.7.3","base": "gearboxworks/gearbox-base:alpine-3.10"},"1.8.6": {"majorversion": "1.8","latest": false,"ref": "composer:1.8.6","base": "gearboxworks/gearbox-base:alpine-3.11"},"1.9.3": {"majorversion": "1.9","latest": false,"ref": "composer:1.9.3","base": "gearboxworks/gearbox-base:alpine-3.11"},"0.9": {"majorversion": "1.10","latest": true,"ref": "composer:1.10.0","base": "gearboxworks/gearbox-base:alpine-3.11"}}}'
23+
LABEL gearbox.version='0.9'
24+
ENV GEARBOX_VERSION "0.9"
25+
LABEL container.class="dev"
26+
ENV GEARBOX_CLASS "dev"
27+
LABEL container.label="Composer"
28+
ENV GEARBOX_LABEL "Composer"
29+
LABEL container.maintainer="Gearbox Team <team@gearbox.works>"
30+
ENV GEARBOX_MAINTAINER "Gearbox Team <team@gearbox.works>"
31+
LABEL container.name="deploywp"
32+
ENV GEARBOX_NAME "deploywp"
33+
LABEL container.organization="gearboxworks"
34+
ENV GEARBOX_ORGANIZATION "gearboxworks"
35+
LABEL container.refurl="https://getcomposer.org/"
36+
ENV GEARBOX_REFURL "https://getcomposer.org/"
37+
LABEL container.state="production"
38+
ENV GEARBOX_STATE "production"
39+
LABEL container.args=""
40+
ENV GEARBOX_ARGS ""
41+
# SKIP env
42+
LABEL container.network="--network gearboxnet"
43+
ENV GEARBOX_NETWORK "--network gearboxnet"
44+
LABEL container.ports="map[]"
45+
ENV GEARBOX_PORTS "map[]"
46+
LABEL container.restart="--restart no"
47+
ENV GEARBOX_RESTART "--restart no"
48+
LABEL container.run=""
49+
ENV GEARBOX_RUN ""
50+
LABEL container.volumes=""
51+
ENV GEARBOX_VOLUMES ""
52+
LABEL container.base="gearboxworks/gearbox-base:alpine-3.11"
53+
ENV GEARBOX_BASE "gearboxworks/gearbox-base:alpine-3.11"
54+
LABEL container.latest="true"
55+
ENV GEARBOX_LATEST "true"
56+
LABEL container.majorversion=""
57+
ENV GEARBOX_MAJORVERSION ""
58+
LABEL container.ref="composer:1.10.0"
59+
ENV GEARBOX_REF "composer:1.10.0"
60+
ENV COMPOSER_USER "gearbox"
61+
62+
# 5. Now copy the local files specific to this container.
63+
COPY build /etc/gearbox
64+
65+
# 6. Run the base.sh script to set everything up.
66+
RUN /bin/sh /etc/gearbox/build/base.sh
67+
68+
# 7. Run the composer.sh script to set everything up.
69+
RUN /bin/sh /etc/gearbox/build/composer.sh
70+
71+
# 8. Expose ports.
72+
EXPOSE 22 9970
73+
WORKDIR /home/gearbox/projects
74+
75+
CMD ["/init"]
76+
77+
# END
78+
################################################################################

docker/Dockerfile2

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM composer
2+
RUN composer global require pantheon-systems/terminus
3+
ENV PATH="/tmp/vendor/bin:${PATH}"
4+
ENV TERMINUS_USER_HOME=/tmp
5+
6+
STOPSIGNAL SIGUSR1
7+
8+
RUN apk add --update py-pip mysql-client bash apk-cron util-linux jq && \
9+
pip install awscli && \
10+
rm -fR /var/cache/apk/*
11+
12+
COPY /files /
13+
14+
RUN chmod 400 /root/.ssh/* && \
15+
chmod 700 /root/.ssh
16+
17+
ENTRYPOINT ["/bin/bash", "/app/export-import.sh"]
18+
19+
RUN ls

docker/DockerfileSAVED

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
ARG VERSION=0.9
2+
3+
# 1. First reference the gearbox-base image.
4+
FROM gearboxworks/gearbox-base:alpine-3.11 as gearbox-base
5+
6+
# 2. Next reference the third party image.
7+
FROM php:7.3-alpine3.11
8+
ARG VERSION
9+
ARG GEARBOX_ENTRYPOINT
10+
ARG GEARBOX_ENTRYPOINT_ARGS
11+
USER root
12+
13+
# 3. Copy the build directory over from gearbox-base image.
14+
COPY --from=gearbox-base /etc/gearbox /etc/gearbox
15+
16+
# 4. Set up env variables.
17+
MAINTAINER Gearbox Team <team@gearbox.works>
18+
ENV GEARBOX_CONTAINER_NAME "docker-pantheon"
19+
ENV GEARBOX_CONTAINER_VERSION ${VERSION}
20+
ENV GEARBOX_ENTRYPOINT ${GEARBOX_ENTRYPOINT}
21+
ENV GEARBOX_ENTRYPOINT_ARGS ${GEARBOX_ENTRYPOINT_ARGS}
22+
LABEL gearbox.json='{"schema": "gear-1","meta": {"state": "production","organization": "gearboxworks","name": "pantheon","label": "Pantheon","maintainer": "Gearbox Team <team@gearbox.works>","class": "admin","refurl": "https://gearboxworks.io/"},"build": {"ports": {"http": "80"},"run": "","args": "","env": {"PANTHEON_USER": "gearbox"},"network": "--network gearboxnet","volumes": "","restart": "--restart no"},"run": {},"project": {},"extensions": {},"versions": {"1.0.0": {"majorversion": "1.0","latest": true,"ref": "php:7.3-alpine3.11","base": "gearboxworks/gearbox-base:alpine-3.11"}}}'
23+
LABEL gearbox.version='1.0.0'
24+
ENV GEARBOX_VERSION "1.0.0"
25+
LABEL container.class="admin"
26+
ENV GEARBOX_CLASS "admin"
27+
LABEL container.label="Pantheon"
28+
ENV GEARBOX_LABEL "Pantheon"
29+
LABEL container.maintainer="Gearbox Team <team@gearbox.works>"
30+
ENV GEARBOX_MAINTAINER "Gearbox Team <team@gearbox.works>"
31+
LABEL container.name="pantheon"
32+
ENV GEARBOX_NAME "pantheon"
33+
LABEL container.organization="gearboxworks"
34+
ENV GEARBOX_ORGANIZATION "gearboxworks"
35+
LABEL container.refurl="https://gearboxworks.io/"
36+
ENV GEARBOX_REFURL "https://gearboxworks.io/"
37+
LABEL container.state="production"
38+
ENV GEARBOX_STATE "production"
39+
LABEL container.args=""
40+
ENV GEARBOX_ARGS ""
41+
# SKIP env
42+
LABEL container.network="--network gearboxnet"
43+
ENV GEARBOX_NETWORK "--network gearboxnet"
44+
LABEL container.ports="map[http:80]"
45+
ENV GEARBOX_PORTS "map[http:80]"
46+
LABEL container.restart="--restart no"
47+
ENV GEARBOX_RESTART "--restart no"
48+
LABEL container.run=""
49+
ENV GEARBOX_RUN ""
50+
LABEL container.volumes=""
51+
ENV GEARBOX_VOLUMES ""
52+
LABEL container.base="gearboxworks/gearbox-base:alpine-3.11"
53+
ENV GEARBOX_BASE "gearboxworks/gearbox-base:alpine-3.11"
54+
LABEL container.latest="true"
55+
ENV GEARBOX_LATEST "true"
56+
LABEL container.majorversion="1.0"
57+
ENV GEARBOX_MAJORVERSION "1.0"
58+
LABEL container.ref="php:7.3-alpine3.11"
59+
ENV GEARBOX_REF "php:7.3-alpine3.11"
60+
ENV PANTHEON_USER "gearbox"
61+
62+
# 5. Now copy the local files specific to this container.
63+
COPY docker/build /etc/gearbox
64+
65+
# 6. Run the base.sh script to set everything up.
66+
RUN /bin/sh /etc/gearbox/build/base.sh
67+
68+
# 7. Run the pantheon.sh script to set everything up.
69+
RUN /bin/sh /etc/gearbox/build/pantheon.sh
70+
71+
# 8. Expose ports.
72+
EXPOSE 22 9970 80
73+
WORKDIR /home/gearbox/projects
74+
75+
CMD ["/init"]
76+
77+
# END
78+
################################################################################

docker/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
all:
2+
-@docker rm -f deploywp-0.9
3+
-@docker image rm -f gearboxworks/deploywp:0.9
4+
@cp ../dist/deploywp_linux_amd64/deploywp build/rootfs/usr/local/bin/
5+
@docker build -f Dockerfile -t gearboxworks/deploywp:0.9 .

docker/build/build/composer.apks

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
py-pip mysql-client bash apk-cron util-linux jq

docker/build/build/composer.apt

Whitespace-only changes.

docker/build/build/composer.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
URL="https://getcomposer.org/download/1.10.5/composer.phar"

docker/build/build/composer.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
3+
test -f /etc/gearbox/bin/colors.sh && . /etc/gearbox/bin/colors.sh
4+
5+
c_ok "Started."
6+
7+
c_ok "Installing packages."
8+
APKBIN="$(which apk)"
9+
if [ "${APKBIN}" != "" ]
10+
then
11+
if [ -f /etc/gearbox/build/composer.apks ]
12+
then
13+
APKS="$(cat /etc/gearbox/build/composer.apks)"
14+
${APKBIN} update && ${APKBIN} add --no-cache ${APKS}; checkExit
15+
fi
16+
fi
17+
18+
APTBIN="$(which apt-get)"
19+
if [ "${APTBIN}" != "" ]
20+
then
21+
if [ -f /etc/gearbox/build/composer.apt ]
22+
then
23+
DEBS="$(cat /etc/gearbox/build/composer.apt)"
24+
${APTBIN} update && ${APTBIN} install ${DEBS}; checkExit
25+
fi
26+
fi
27+
28+
29+
if [ -f /etc/gearbox/build/composer.env ]
30+
then
31+
. /etc/gearbox/build/composer.env
32+
fi
33+
34+
if [ ! -d /usr/local/bin ]
35+
then
36+
mkdir -p /usr/local/bin; checkExit
37+
fi
38+
39+
cd /usr/local/bin
40+
wget -qO composer --no-check-certificate ${URL}; checkExit
41+
chmod a+x /usr/local/bin/composer
42+
43+
44+
pip install awscli; checkExit
45+
46+
47+
c_ok "Finished."

docker/build/gearbox-composer.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"schema": "gear-1",
3+
"meta": {
4+
"state": "production",
5+
"organization": "gearboxworks",
6+
"name": "pantheon",
7+
"label": "Pantheon",
8+
"maintainer": "Gearbox Team <team@gearbox.works>",
9+
"class": "admin",
10+
"refurl": "https://gearboxworks.io/"
11+
},
12+
"build": {
13+
"ports": {
14+
"http": "80"
15+
},
16+
"run": "",
17+
"args": "",
18+
"env": {
19+
"PANTHEON_USER": "gearbox"
20+
},
21+
"network": "--network gearboxnet",
22+
"volumes": "",
23+
"restart": "--restart no"
24+
},
25+
"run": {
26+
},
27+
"project": {
28+
},
29+
"extensions": {
30+
},
31+
"versions": {
32+
"1.0.0": {
33+
"majorversion": "1.0",
34+
"latest": true,
35+
"ref": "php:7.3-alpine3.11",
36+
"base": "gearboxworks/gearbox-base:alpine-3.11"
37+
}
38+
}
39+
}

0 commit comments

Comments
 (0)