Skip to content

Commit a216149

Browse files
committed
Re-implement based on Debian base image
flownative/beach#185
1 parent 399e54e commit a216149

File tree

14 files changed

+413
-44
lines changed

14 files changed

+413
-44
lines changed

.github/build-env.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
#BUILD_ARG_NGINX_VERSION=$(wget -qO- https://versions.flownative.io/projects/base/channels/stable/versions/nginx.txt)
2-
export BUILD_ARG_NGINX_VERSION=1.14.0-0ubuntu1.7
1+
export BUILD_ARG_NGINX_VERSION=1.14.2-2+deb10u1

.github/workflows/docker.build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
tag_ref: ${{ github.ref }}
2020
git_repository_url: https://github.com/${{ github.repository }}
2121
git_sha: ${{ github.sha }}
22-
image_name: flownative/docker-beach-nginx/beach-nginx
22+
image_name: flownative/docker-nginx/nginx
2323
registry_password: ${{ secrets.GITHUB_BOT_TOKEN }}
2424

2525
- name: Dispatch

.github/workflows/docker.nightly.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
uses: flownative/action-docker-build@v1
2222
with:
2323
tag_ref: ${{ steps.latest_version.outputs.tag }}
24-
image_name: flownative/docker-beach-nginx/beach-nginx
24+
image_name: flownative/docker-nginx/nginx
2525
git_repository_url: https://github.com/${{ github.repository }}
2626
git_sha: ${{ github.sha }}
2727
registry_password: ${{ secrets.GITHUB_BOT_TOKEN }}

.github/workflows/docker.release.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
source_registry_password: ${{ secrets.GITHUB_BOT_TOKEN }}
3939
source_registry_endpoint: https://docker.pkg.github.com/v2/
4040

41-
target_image_name: eu.gcr.io/flownative-beach/beach-nginx
41+
target_image_name: eu.gcr.io/flownative-beach/nginx
4242
target_registry_username: '_json_key'
4343
target_registry_password: ${{ secrets.GOOGLE_REGISTRY_PASSWORD }}
4444
target_registry_endpoint: https://eu.gcr.io/v2/
@@ -54,7 +54,7 @@ jobs:
5454
source_registry_password: ${{ secrets.GITHUB_BOT_TOKEN }}
5555
source_registry_endpoint: https://docker.pkg.github.com/v2/
5656

57-
target_image_name: eu.gcr.io/flownative-beach-a7c8b2/beach-nginx
57+
target_image_name: eu.gcr.io/flownative-beach-a7c8b2/nginx
5858
target_registry_username: '_json_key'
5959
target_registry_password: ${{ secrets.GOOGLE_REGISTRY_PASSWORD_A7C8B2 }}
6060
target_registry_endpoint: https://eu.gcr.io/v2/
@@ -74,7 +74,7 @@ jobs:
7474
source_registry_password: ${{ secrets.GITHUB_BOT_TOKEN }}
7575
source_registry_endpoint: https://docker.pkg.github.com/v2/
7676

77-
target_image_name: flownative/beach-nginx
77+
target_image_name: flownative/nginx
7878
target_registry_username: ${{ secrets.DOCKER_IO_REGISTRY_USER }}
7979
target_registry_password: ${{ secrets.DOCKER_IO_REGISTRY_PASSWORD }}
8080
target_registry_endpoint: https://index.docker.io/v1/

Dockerfile

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM docker.pkg.github.com/flownative/docker-base/base:1
1+
FROM docker.pkg.github.com/flownative/docker-base/base:buster
22
MAINTAINER Robert Lemke <[email protected]>
33

44
LABEL org.label-schema.name="Beach Nginx"
@@ -7,36 +7,35 @@ LABEL org.label-schema.vendor="Flownative GmbH"
77

88
# -----------------------------------------------------------------------------
99
# Nginx
10-
# Latest versions: https://packages.ubuntu.com/bionic/nginx
10+
# Latest versions: https://packages.debian.org/buster/nginx
1111

1212
ARG NGINX_VERSION
1313
ENV NGINX_VERSION ${NGINX_VERSION}
1414

15-
# Create the beach user and group
16-
RUN groupadd -r -g 1000 beach && \
17-
useradd -s /bin/bash -r -g beach -G beach -p "*" -u 1000 beach && \
18-
rm -f /var/log/* /etc/group~ /etc/gshadow~
19-
20-
# Note: we need nginx-extras for the chunkin and more headers module and apache2-utils for the htpasswd command
21-
RUN apt-get update \
22-
&& apt-get install \
23-
nginx-common=${NGINX_VERSION} \
24-
nginx-extras=${NGINX_VERSION} \
25-
&& rm -rf /var/lib/apt/lists/* \
26-
&& rm -rf /var/log/apt \
27-
&& rm -rf /var/log/dpkg.log \
28-
&& rm -rf /var/www \
15+
ENV FLOWNATIVE_LIB_PATH=/opt/flownative/lib \
16+
NGINX_BASE_PATH=/opt/flownative/nginx \
17+
PATH="/opt/flownative/nginx/bin:$PATH" \
18+
LOG_DEBUG=false
19+
20+
COPY --from=docker.pkg.github.com/flownative/bash-library/bash-library:1 /lib $FLOWNATIVE_LIB_PATH
21+
22+
# Note: We need nginx-extras for the chunkin and more headers module and apache2-utils for the htpasswd command.
23+
# The gettext package provides "envsubst" for templating.
24+
RUN install_packages \
25+
ca-certificates \
26+
nginx-common=${NGINX_VERSION} \
27+
nginx-extras=${NGINX_VERSION} \
28+
gettext \
29+
curl \
30+
procps \
2931
&& rm /etc/nginx/sites-available/default \
3032
&& rm /etc/nginx/sites-enabled/default
3133

32-
# Forward request and error logs to docker log collector
33-
RUN ln -sf /dev/stdout /var/log/nginx/access.log && \
34-
ln -sf /dev/stderr /var/log/nginx/error.log
34+
COPY root-files /
35+
RUN /build.sh
3536

36-
COPY service-nginx.sh /etc/service/nginx/run
37-
RUN chmod 755 /etc/service/nginx/run \
38-
&& chown root:root /etc/service/nginx/run
39-
COPY nginx.conf /etc/nginx/nginx.conf
40-
COPY mime.types /etc/nginx/
37+
EXPOSE 8080
4138

42-
EXPOSE 80
39+
USER 1000
40+
ENTRYPOINT [ "/entrypoint.sh" ]
41+
CMD [ "/run.sh" ]

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015-2019 Robert Lemke, Flownative GmbH
3+
Copyright (c) 2015-2020 Robert Lemke, Flownative GmbH
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ of the tools as build arguments:
99

1010
```bash
1111
docker build \
12-
--build-arg NGINX_VERSION=1.14.0-0ubuntu1.6 \
13-
-t flownative/beach-nginx:latest .
12+
--build-arg NGINX_VERSION=1.14.2-2+deb10u1 \
13+
-t flownative/nginx:latest .
1414
```
1515

1616
Check the latest stable release on the tool's respective websites:
1717

18-
- Nginx: https://packages.ubuntu.com/bionic/nginx
18+
- Nginx: https://packages.debian.org/buster/nginx

root-files/build.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
3+
set -o errexit
4+
set -o nounset
5+
set -o pipefail
6+
7+
mkdir -p \
8+
"${NGINX_BASE_PATH}/sbin" \
9+
"${NGINX_BASE_PATH}/etc" \
10+
"${NGINX_BASE_PATH}/tmp" \
11+
"${NGINX_BASE_PATH}/log"
12+
13+
mv /etc/nginx/* "${NGINX_BASE_PATH}/etc/"
14+
mv /usr/sbin/nginx "${NGINX_BASE_PATH}/sbin/"
15+
16+
chown -R root:root "${NGINX_BASE_PATH}"
17+
chmod -R g+rwX "${NGINX_BASE_PATH}"
18+
chmod 664 "${NGINX_BASE_PATH}"/etc/*.conf
19+
20+
# Forward request and error logs to docker log collector
21+
ln -sf /dev/stdout "${NGINX_BASE_PATH}/log/access.log"
22+
ln -sf /dev/stderr "${NGINX_BASE_PATH}/log/error.log"
23+
24+
# Nginx will try to access /var/log/nginx once, before even reading its
25+
# configuration file. This results in a "permission denied" error, if
26+
# Nginx does not have access to the default directory. Therefore we
27+
# create it, but don't use it:
28+
mkdir -p /var/log/nginx
29+
chown -R root:root /var/log/nginx
30+
chmod -R g+rwX /var/log/nginx
31+
32+
# For backwards-compatibility, create the /application/Web directory:
33+
mkdir -p /application/Web
34+
chown -R root:root /application/Web
35+
chmod -R g+rwX /application/Web

root-files/entrypoint.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
set -o errexit
4+
set -o nounset
5+
set -o pipefail
6+
7+
# Load lib
8+
. "${FLOWNATIVE_LIB_PATH}/nginx.sh"
9+
. "${FLOWNATIVE_LIB_PATH}/nginx-legacy.sh"
10+
11+
eval "$(nginx_env)"
12+
eval "$(nginx_legacy_env)"
13+
14+
if [[ "$*" = *"/run.sh"* ]]; then
15+
nginx_initialize
16+
nginx_legacy_initialize
17+
fi
18+
19+
exec "$@"

0 commit comments

Comments
 (0)