Last active
July 2, 2019 12:30
-
-
Save hinablue/8396f4cf7b643746eb3aa2f0a3a84d2b to your computer and use it in GitHub Desktop.
NginxLua
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
version: '3' | |
services: | |
nginx: | |
image: hinablue/nginx-lua:1.14 | |
environment: | |
- NODE_ENV=production | |
volumes: | |
- ./shared:/volume/shared | |
- ./configs/Nginx:/volume/config | |
- ./data/projects:/volume/data | |
- ./logs/nginx:/volume/log | |
ports: | |
- "80:80" | |
- "443:443" | |
restart: always |
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
FROM openresty/openresty:alpine | |
MAINTAINER Hina Chen <hinablue@gmail.com> | |
WORKDIR /build | |
# Install Nginx | |
RUN apk --update add \ | |
nginx \ | |
nginx-mod-http-lua \ | |
nginx-mod-http-lua-upstream | |
RUN mkdir /volume \ | |
&& mkdir /volume/log \ | |
&& mkdir /volume/data \ | |
&& mkdir /volume/config \ | |
&& mkdir /volume/shared \ | |
&& chmod a+w /volume/* \ | |
&& mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak \ | |
&& ln -s /volume/config/nginx.conf /etc/nginx/nginx.conf | |
VOLUME ["/volume/config", "/volume/data", "/volume/log"] | |
COPY entrypoint.sh /entrypoint.sh | |
ENTRYPOINT ["/entrypoint.sh"] | |
EXPOSE 80/tcp | |
EXPOSE 443/tcp | |
CMD /usr/sbin/nginx -g "daemon off;" |
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
#!/usr/bin/env sh | |
set -e | |
exec "$@" |
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
#!/usr/bin/env bash | |
cd `dirname $0` | |
IMAGE_NAME="hinablue/nginx-lua:1.14" | |
case "$1" in | |
build) | |
docker build -t $IMAGE_NAME . | |
;; | |
rebuild) | |
docker build --no-cache -t $IMAGE_NAME . | |
;; | |
push) | |
docker push $IMAGE_NAME | |
;; | |
*) | |
echo $"Usage: $0 {build|rebuild|push}" | |
exit 1 | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment