Skip to content

Commit b3196fb

Browse files
authored
Merge pull request #48 from devilbox/release-0.44
Add Alpine Docker flavour
2 parents 8f01d38 + 226d691 commit b3196fb

30 files changed

+152
-10
lines changed

.github/workflows/action_branch.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
# (2/2) Build
2323
docker:
2424
needs: [params]
25-
uses: devilbox/github-actions/.github/workflows/docker-name-version-arch.yml@master
25+
uses: devilbox/github-actions/.github/workflows/docker-name-version-flavour-arch.yml@master
2626
with:
2727
enabled: true
2828
can_deploy: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/release-') }}

.github/workflows/action_pull_request.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
# (2/2) Build
2525
docker:
2626
needs: [params]
27-
uses: devilbox/github-actions/.github/workflows/docker-name-version-arch.yml@master
27+
uses: devilbox/github-actions/.github/workflows/docker-name-version-flavour-arch.yml@master
2828
with:
2929
enabled: true
3030
can_deploy: false

.github/workflows/action_schedule.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
# (2/2) Build
2525
docker:
2626
needs: [params]
27-
uses: devilbox/github-actions/.github/workflows/docker-name-version-arch.yml@master
27+
uses: devilbox/github-actions/.github/workflows/docker-name-version-flavour-arch.yml@master
2828
with:
2929
enabled: true
3030
can_deploy: true

.github/workflows/params.yml

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ env:
1515
{
1616
"NAME": "Nginx",
1717
"VERSION": ["stable"],
18+
"FLAVOUR": ["latest", "debian", "alpine"],
1819
"ARCH": ["linux/amd64", "linux/386", "linux/arm64", "linux/arm/v7", "linux/arm/v6"]
1920
}
2021
]

Dockerfiles/Dockerfile.alpine

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
FROM nginx:stable-alpine
2+
MAINTAINER "cytopia" <[email protected]>
3+
4+
LABEL \
5+
name="cytopia's nginx stable image" \
6+
image="devilbox/nginx-stable" \
7+
vendor="devilbox" \
8+
license="MIT"
9+
10+
11+
###
12+
### Build arguments
13+
###
14+
ARG VHOST_GEN_GIT_REF=1.0.3
15+
ARG WATCHERD_GIT_REF=v1.0.2
16+
ARG CERT_GEN_GIT_REF=0.7
17+
18+
ENV BUILD_DEPS \
19+
make \
20+
wget
21+
22+
ENV RUN_DEPS \
23+
ca-certificates \
24+
bash \
25+
openssl \
26+
py3-yaml \
27+
shadow \
28+
supervisor
29+
30+
31+
###
32+
### Runtime arguments
33+
###
34+
ENV MY_USER=nginx
35+
ENV MY_GROUP=nginx
36+
ENV HTTPD_START="/usr/sbin/nginx"
37+
ENV HTTPD_RELOAD="nginx -s stop"
38+
39+
40+
###
41+
### Install required packages
42+
###
43+
RUN set -eux \
44+
&& apk add --no-cache \
45+
${BUILD_DEPS} \
46+
${RUN_DEPS} \
47+
\
48+
# Install vhost-gen
49+
&& wget --no-check-certificate -O vhost-gen.tar.gz "https://github.com/devilbox/vhost-gen/archive/refs/tags/${VHOST_GEN_GIT_REF}.tar.gz" \
50+
&& tar xvfz vhost-gen.tar.gz \
51+
&& cd "vhost-gen-${VHOST_GEN_GIT_REF}" \
52+
&& make install \
53+
&& cd .. \
54+
&& rm -rf vhost*gen* \
55+
\
56+
# Install cert-gen
57+
&& wget --no-check-certificate -O /usr/bin/ca-gen https://raw.githubusercontent.com/devilbox/cert-gen/${CERT_GEN_GIT_REF}/bin/ca-gen \
58+
&& wget --no-check-certificate -O /usr/bin/cert-gen https://raw.githubusercontent.com/devilbox/cert-gen/${CERT_GEN_GIT_REF}/bin/cert-gen \
59+
&& chmod +x /usr/bin/ca-gen \
60+
&& chmod +x /usr/bin/cert-gen \
61+
\
62+
# Install watcherd
63+
&& wget --no-check-certificate -O /usr/bin/watcherd https://raw.githubusercontent.com/devilbox/watcherd/${WATCHERD_GIT_REF}/watcherd \
64+
&& chmod +x /usr/bin/watcherd \
65+
\
66+
# Clean-up
67+
&& apk del \
68+
${BUILD_DEPS}
69+
70+
71+
###
72+
### Create directories
73+
###
74+
# /docker-entrypoint.d/10-ipv6* was added by nginx to do some IPv6 magic (which breaks the image)
75+
RUN set -eux \
76+
&& rm -rf /docker-entrypoint.d || true \
77+
&& mkdir -p /etc/httpd-custom.d \
78+
&& mkdir -p /etc/httpd/conf.d \
79+
&& mkdir -p /etc/httpd/vhost.d \
80+
&& mkdir -p /var/www/default/htdocs \
81+
&& mkdir -p /shared/httpd \
82+
&& chmod 0775 /shared/httpd \
83+
&& chown ${MY_USER}:${MY_GROUP} /shared/httpd
84+
85+
86+
###
87+
### Symlink Python3 to Python
88+
###
89+
RUN set -eux \
90+
&& ln -sf /usr/bin/python3 /usr/bin/python
91+
92+
93+
###
94+
### Copy files
95+
###
96+
COPY ./data/nginx/nginx.conf /etc/nginx/nginx.conf
97+
COPY ./data/vhost-gen/main.yml /etc/vhost-gen/main.yml
98+
COPY ./data/vhost-gen/mass.yml /etc/vhost-gen/mass.yml
99+
COPY ./data/vhost-gen/templates-main /etc/vhost-gen/templates-main
100+
COPY ./data/create-vhost.sh /usr/local/bin/create-vhost.sh
101+
COPY ./data/docker-entrypoint.d /docker-entrypoint.d
102+
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
103+
104+
105+
###
106+
### Ports
107+
###
108+
EXPOSE 80
109+
EXPOSE 443
110+
111+
112+
###
113+
### Volumes
114+
###
115+
VOLUME /shared/httpd
116+
VOLUME /ca
117+
118+
119+
###
120+
### Signals
121+
###
122+
STOPSIGNAL SIGTERM
123+
124+
125+
###
126+
### Entrypoint
127+
###
128+
ENTRYPOINT ["/docker-entrypoint.sh"]
File renamed without changes.

Dockerfiles/Dockerfile.latest

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dockerfile.debian
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Makefile

+12-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,18 @@ TAG = latest
2727
NAME = Nginx
2828
VERSION = stable
2929
IMAGE = devilbox/nginx-$(VERSION)
30-
DIR = .
31-
FILE = Dockerfile
32-
DOCKER_TAG = $(TAG)
30+
FLAVOUR = latest
31+
DIR = Dockerfiles
32+
FILE = Dockerfile.$(FLAVOUR)
33+
ifeq ($(strip $(FLAVOUR)),latest)
34+
DOCKER_TAG = $(TAG)
35+
else
36+
ifeq ($(strip $(TAG)),latest)
37+
DOCKER_TAG = $(FLAVOUR)
38+
else
39+
DOCKER_TAG = $(FLAVOUR)-$(TAG)
40+
endif
41+
endif
3342
ARCH = linux/amd64
3443

3544

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
**[devilbox/docker-nginx-stable](https://github.com/devilbox/docker-nginx-stable)**
1313

14-
**Available Architectures:** `amd64`, `arm64`, `386`, `arm/v7`, `arm/v6`
14+
* **Available Architectures:** `amd64`, `arm64`, `386`, `arm/v7`, `arm/v6`
15+
* **Available Docker tags:** `latest`, `alpine`, `debian`
1516

1617
This image is based on the official **[Nginx](https://hub.docker.com/_/nginx)** Docker image and extends it with the ability to have **virtual hosts created automatically**, as well as **adding SSL certificates** when creating new directories. For that to work, it integrates two tools that will take care about the whole process: **[watcherd](https://github.com/devilbox/watcherd)** and **[vhost-gen](https://github.com/devilbox/vhost-gen)**.
1718

tests/00.sh

+5-3
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,24 @@ run "echo \"hello world\" > ${RAND_DIR}/index.html"
3232
###
3333
### Startup container
3434
###
35-
run "docker run -d --rm --platform ${ARCH} \
35+
run "docker run --rm --platform ${ARCH} \
3636
-v ${RAND_DIR}:/var/www/default/htdocs \
3737
-p 127.0.0.1:80:80 \
3838
-e DEBUG_ENTRYPOINT=2 \
3939
-e DEBUG_RUNTIME=1 \
4040
-e NEW_UID=$( id -u ) \
4141
-e NEW_GID=$( id -g ) \
42-
--name ${RAND_NAME} ${IMAGE}:${TAG}"
42+
--name ${RAND_NAME} ${IMAGE}:${TAG} &"
4343

4444

4545
###
4646
### Tests
4747
###
4848
run "sleep 20" # Startup-time is longer on cross-platform
4949
run "docker ps"
50-
run "docker logs ${RAND_NAME}"
50+
if ! run "docker logs ${RAND_NAME}"; then
51+
exit 1
52+
fi
5153
if ! run "curl -sS localhost/index.html"; then
5254
run "docker stop ${RAND_NAME}"
5355
exit 1

0 commit comments

Comments
 (0)