-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix - rework dockerfile and nginx conf
- Loading branch information
1 parent
443a547
commit a0e6797
Showing
3 changed files
with
22 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,33 @@ | ||
FROM nginx:stable-alpine | ||
COPY build /usr/share/nginx/html | ||
|
||
## Remove default nginx index page | ||
RUN rm -rf /usr/share/nginx/html/* | ||
|
||
ADD build /usr/share/nginx/html | ||
|
||
RUN rm etc/nginx/conf.d/default.conf | ||
COPY nginx-frontmoog.conf etc/nginx/conf.d/ | ||
COPY nginx.conf etc/nginx/conf.d/ | ||
|
||
# Copy .env file and shell script to container | ||
WORKDIR /usr/share/nginx/html | ||
|
||
# Add bash | ||
RUN apk add --no-cache bash | ||
|
||
COPY ./scripts/env.sh . | ||
COPY .env . | ||
|
||
# Make shell script executable | ||
RUN chmod +x env.sh | ||
|
||
# add non-root user | ||
RUN touch /var/run/nginx.pid | ||
RUN chown -R nginx:nginx /var/run/nginx.pid /usr/share/nginx/html /var/cache/nginx /var/log/nginx /etc/nginx/conf.d | ||
|
||
# non root users cannot listen on 80 | ||
EXPOSE 8080 | ||
|
||
USER nginx | ||
|
||
# Start Nginx server | ||
CMD ["/bin/bash", "-c", "/usr/share/nginx/html/env.sh && nginx -g \"daemon off;\""] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
server { | ||
listen 80 default_server; | ||
listen 8080; | ||
server_name /usr/share/nginx/html; | ||
|
||
root /usr/share/nginx/html; | ||
|
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