Skip to content
This repository has been archived by the owner. It is now read-only.

Binary location change, Config location change, mountable sites-enabled folder #11

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 41 additions & 6 deletions 1.6/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ RUN buildDeps=" \
&& ./configure \
--user=www-data \
--group=www-data \
--prefix=/usr/local/nginx \
--conf-path=/etc/nginx.conf \
--prefix=/usr/share/nginx \
--conf-path=/etc/nginx/nginx.conf \
--http-log-path=/proc/self/fd/1 \
--error-log-path=/proc/self/fd/2 \
--with-http_addition_module \
Expand All @@ -136,16 +136,51 @@ RUN buildDeps=" \
&& make install \
&& cd / \
&& rm -r /usr/src/nginx \
&& chown -R www-data:www-data /usr/local/nginx \
&& chown -R www-data:www-data /usr/share/nginx \
&& { \
echo; \
echo 'worker_processes 1;'; \
echo; \
echo 'events {'; \
echo ' worker_connections 1024;'; \
echo '}'; \
echo; \
echo 'http {'; \
echo ' include mime.types;'; \
echo ' default_type application/octet-stream;'; \
echo ' sendfile on;'; \
echo ' keepalive_timeout 65;'; \
echo ' include /etc/nginx/sites-enabled/*;'; \
echo '}'; \
echo; \
echo '# stay in the foreground so Docker has a process to track'; \
echo 'daemon off;'; \
} >> /etc/nginx.conf \
} > /etc/nginx/nginx.conf \
&& mkdir -p /etc/nginx/sites-enabled \
&& { \
echo; \
echo 'server {'; \
echo ' listen 80;'; \
echo ' server_name localhost;'; \
echo; \
echo ' location / {'; \
echo ' root html;'; \
echo ' index index.html index.htm;'; \
echo ' }'; \
echo; \
echo ' error_page 500 502 503 504 /50x.html;'; \
echo ' location = /50x.html {'; \
echo ' root html;'; \
echo ' }'; \
echo; \
echo '}'; \
} > /etc/nginx/sites-enabled/default.conf \
&& apt-get purge -y --auto-remove $buildDeps

ENV PATH /usr/local/nginx/sbin:$PATH
WORKDIR /usr/local/nginx/html
VOLUME ["/etc/nginx/sites-enabled"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more thought is to just make this VOLUME /etc/nginx

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now /etc/nginx has some default config files (mime.types, for example) that I think a "regular" user will not be aware of their existence...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That doesn't really affect making all of /etc/nginx a volume in the Dockerfile, though. (Plus, for purposes like this image's use in Plushu, we want to override those files anyway.)


ENV PATH /usr/share/nginx/sbin:$PATH
WORKDIR /usr/share/nginx/html

# TODO USER www-data

Expand Down
47 changes: 41 additions & 6 deletions 1.7/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ RUN buildDeps=" \
&& ./configure \
--user=www-data \
--group=www-data \
--prefix=/usr/local/nginx \
--conf-path=/etc/nginx.conf \
--prefix=/usr/share/nginx \
--conf-path=/etc/nginx/nginx.conf \
--http-log-path=/proc/self/fd/1 \
--error-log-path=/proc/self/fd/2 \
--with-http_addition_module \
Expand All @@ -136,16 +136,51 @@ RUN buildDeps=" \
&& make install \
&& cd / \
&& rm -r /usr/src/nginx \
&& chown -R www-data:www-data /usr/local/nginx \
&& chown -R www-data:www-data /usr/share/nginx \
&& { \
echo; \
echo 'worker_processes 1;'; \
echo; \
echo 'events {'; \
echo ' worker_connections 1024;'; \
echo '}'; \
echo; \
echo 'http {'; \
echo ' include mime.types;'; \
echo ' default_type application/octet-stream;'; \
echo ' sendfile on;'; \
echo ' keepalive_timeout 65;'; \
echo ' include /etc/nginx/sites-enabled/*;'; \
echo '}'; \
echo; \
echo '# stay in the foreground so Docker has a process to track'; \
echo 'daemon off;'; \
} >> /etc/nginx.conf \
} > /etc/nginx/nginx.conf \
&& mkdir -p /etc/nginx/sites-enabled \
&& { \
echo; \
echo 'server {'; \
echo ' listen 80;'; \
echo ' server_name localhost;'; \
echo; \
echo ' location / {'; \
echo ' root html;'; \
echo ' index index.html index.htm;'; \
echo ' }'; \
echo; \
echo ' error_page 500 502 503 504 /50x.html;'; \
echo ' location = /50x.html {'; \
echo ' root html;'; \
echo ' }'; \
echo; \
echo '}'; \
} > /etc/nginx/sites-enabled/default.conf \
&& apt-get purge -y --auto-remove $buildDeps

ENV PATH /usr/local/nginx/sbin:$PATH
WORKDIR /usr/local/nginx/html
VOLUME ["/etc/nginx/sites-enabled"]

ENV PATH /usr/share/nginx/sbin:$PATH
WORKDIR /usr/share/nginx/html

# TODO USER www-data

Expand Down