Skip to content

Instantly share code, notes, and snippets.

@dgk
Last active December 2, 2020 15:37
Show Gist options
  • Save dgk/845709439da36e07044373f15d73ea7e to your computer and use it in GitHub Desktop.
Save dgk/845709439da36e07044373f15d73ea7e to your computer and use it in GitHub Desktop.
# nginx image with fake /bin/sh
# to use a non-standard port:
# docker build --build-arg PORT=8000 .
FROM nginx:alpine
ARG PORT=80
RUN sed -i "s/80/$PORT/" /etc/nginx/conf.d/default.conf
RUN apk add --no-cache bash
RUN echo -e '#!/bin/bash\nnginx -g "daemon off;"' > /bin/sh-fake
RUN chmod +x /bin/sh-fake
RUN mv /bin/sh-fake /bin/sh
EXPOSE $PORT
ENTRYPOINT /bin/sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment