Created
March 21, 2023 01:42
-
-
Save saku/d119bacde3042a994ae2635af7ee2fe3 to your computer and use it in GitHub Desktop.
How to create simple proxy image
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
$ TMP_DIR=$(mktemp -d) && cd $TMP_DIR | |
$ cat << EOF > Dockerfile | |
FROM nginx:alpine | |
ENV NGINX_PORT=8080 | |
ENV PROXY_PROTOCOL=https | |
ENV PROXY_HOST=localhost | |
ENV PROXY_PATH= | |
COPY ./templates /etc/nginx/templates | |
EXPOSE 8080 | |
EOF | |
$ mkdir templates | |
$ cat << EOF > templates/default.conf.template | |
server { | |
listen ${NGINX_PORT}; | |
location / { | |
proxy_pass ${PROXY_PROTOCOL}://${PROXY_HOST}${PROXY_PATH}; | |
} | |
} | |
EOF | |
$ tree | |
. | |
├── Dockerfile | |
└── templates | |
└── default.conf.template | |
$ docker build -t gcr.io/your-project/pubsub-proxy:blog . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment