Skip to content

Instantly share code, notes, and snippets.

@hinablue
Last active July 2, 2019 12:30
Show Gist options
  • Save hinablue/8396f4cf7b643746eb3aa2f0a3a84d2b to your computer and use it in GitHub Desktop.
Save hinablue/8396f4cf7b643746eb3aa2f0a3a84d2b to your computer and use it in GitHub Desktop.
NginxLua
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
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;"
#!/usr/bin/env sh
set -e
exec "$@"
#!/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