Skip to content

Instantly share code, notes, and snippets.

@saku
Created March 21, 2023 01:42
Show Gist options
  • Save saku/d119bacde3042a994ae2635af7ee2fe3 to your computer and use it in GitHub Desktop.
Save saku/d119bacde3042a994ae2635af7ee2fe3 to your computer and use it in GitHub Desktop.
How to create simple proxy image
$ 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