Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce size of web service using nginx stable-alpine #2944

Merged
merged 1 commit into from
Feb 17, 2022

Conversation

TDDR
Copy link
Contributor

@TDDR TDDR commented Feb 16, 2022

Issue This PR Addresses

Fixes #2835

Type of Change

There has been some discussion in the issue itself about how to tackle this. As requested by @humphd I have made a PR to get some help figuring this out.

Using USER nginx should work. What does it show when you do this? Can you put the whole Dockerfile up somewhere so I can test with you?

Yesterday when I was trying this, I was getting an error message saying something like the nginx user was not fond. Today, when I went to replicate the error I get this message now when I run a pnpm services:start
image

Switching into the web folder cd src/web and then running a docker build . produces a similar error
image

  • Bugfix: Change which fixes an issue
  • New Feature: Change which adds functionality
  • Documentation Update: Change which improves documentation
  • UI: Change which improves UI

Description

Steps to test the PR

  • checkout the pr gh pr checkout 2944
  • pnpm services:start
  • the project should build without error

Checklist

  • Quality: This PR builds and passes our npm test and works locally
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Screenshots: This PR includes screenshots or GIFs of the changes made or an explanation of why it does not (if applicable)
  • Documentation: This PR includes updated/added documentation to user exposed functionality or configuration variables are added/changed or an explanation of why it does not(if applicable)

@TDDR TDDR added the help wanted Extra attention is needed label Feb 16, 2022
@TDDR TDDR self-assigned this Feb 16, 2022
@gitpod-io
Copy link

gitpod-io bot commented Feb 16, 2022

@manekenpix
Copy link
Member

I'm getting this at launch

nginx   | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
nginx   | /docker-entrypoint.sh: Configuration complete; ready for start up
nginx   | 2022/02/16 00:44:11 [warn] 1#1: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:22
nginx   | nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:22
nginx   | 2022/02/16 00:44:11 [emerg] 1#1: mkdir() "/var/cache/nginx/client_temp" failed (13: Permission denied)
nginx   | nginx: [emerg] mkdir() "/var/cache/nginx/client_temp" failed (13: Permission denied)
nginx exited with code 1

@manekenpix
Copy link
Member

I was able to run web removing the user in the Dockerfile (USER nginx) and removing this line. We'd also have to remove the same line in nginx.conf.development.template.
I tested it on staging and it seems to run with no issues.

@manekenpix
Copy link
Member

manekenpix commented Feb 16, 2022

Using USER nginx should work. What does it show when you do this? Can you put the whole Dockerfile up somewhere so I can test with you?

I did some testing and removing USER nginx from Dockerfile and adding user nginx; (instead of www-data) to nginx.template and nginx.conf.development.template (line 22) seems to work.

@humphd
Copy link
Contributor

humphd commented Feb 16, 2022

Let's switch the user we use in the two nginx.conf files like @manekenpix suggests.

@TDDR TDDR requested a review from TueeNguyen February 17, 2022 01:39
@TDDR TDDR added area: docker type: enhancement New feature or request and removed help wanted Extra attention is needed labels Feb 17, 2022
@TDDR TDDR marked this pull request as ready for review February 17, 2022 01:40
@TDDR TDDR changed the title Attempting to reduce size by using nginx stable-alpine Reduce size of web service using nginx stable-alpine Feb 17, 2022
Copy link
Contributor

@humphd humphd left a comment

Choose a reason for hiding this comment

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

This is great. Please file issues/PRs to do the same thing in other containers.

@menghif menghif merged commit d1ec8e5 into Seneca-CDOT:master Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: docker type: enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve size of web Dockerfile
4 participants