Skip to content

fix: dockerfile: use unprivileged nginx #1657

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

Merged
merged 13 commits into from
Jul 8, 2025
Merged
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
2 changes: 1 addition & 1 deletion CI/e2e/docker-compose.e2e.yaml
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ services:
build:
context: .
ports:
- 4200:80
- 4200:8080
volumes:
- "./CI/e2e/frontend.config.e2e.json:/usr/share/nginx/html/assets/config.json"
depends_on:
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -8,8 +8,11 @@ RUN npm ci
COPY . /frontend/
RUN npx ng build

FROM nginx:1.28-alpine
FROM docker.io/nginxinc/nginx-unprivileged:1.26.3
USER root
RUN rm -rf /usr/share/nginx/html/*
COPY --from=builder /frontend/dist/browser/ /usr/share/nginx/html/
COPY scripts/nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
USER 101
COPY --from=builder /frontend/dist/ /usr/share/nginx/html/
EXPOSE 8080
7 changes: 3 additions & 4 deletions scripts/nginx.conf
Original file line number Diff line number Diff line change
@@ -2,10 +2,9 @@
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
pid /tmp/nginx.pid;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
@@ -31,8 +30,8 @@ http {
default_type application/octet-stream;

server {
listen 80 default_server;
listen [::]:80 default_server;
listen 8080 default_server;
listen [::]:8080 default_server;
server_name _;
root /usr/share/nginx/html;


Unchanged files with check annotations Beta

* Needs to return either a boolean or an observable that maps to a boolean
*/
canActivate(
route: ActivatedRouteSnapshot,

Check warning on line 30 in src/app/app-routing/auth.guard.ts

GitHub Actions / eslint

'route' is defined but never used
state: RouterStateSnapshot,

Check warning on line 31 in src/app/app-routing/auth.guard.ts

GitHub Actions / eslint

'state' is defined but never used
): Promise<boolean> {
return this.us
.usersControllerGetMyUserV3()
datasetReduceEnabled: boolean;
datasetDetailsShowMissingProposalId: boolean;
datafilesActionsEnabled: boolean;
datafilesActions: any[];

Check warning on line 59 in src/app/app-config.service.ts

GitHub Actions / eslint

Unexpected any. Specify a different type
editDatasetEnabled: boolean;
editDatasetSampleEnabled: boolean;
editMetadataEnabled: boolean;
defaultMainPage?: MainPageConfiguration;
}
function isMainPageConfiguration(obj: any): obj is MainPageConfiguration {

Check warning on line 125 in src/app/app-config.service.ts

GitHub Actions / eslint

Unexpected any. Specify a different type
const validKeys = Object.keys(MainPageOptions);
return (
obj &&
.pipe(timeout(2000))
.toPromise();
this.appConfig = Object.assign({}, this.appConfig, config);
} catch (err) {

Check warning on line 150 in src/app/app-config.service.ts

GitHub Actions / eslint

'err' is defined but never used
console.log("No config available in backend, trying with local config.");
try {
const config = await this.http.get("/assets/config.json").toPromise();
this.appConfig = Object.assign({}, this.appConfig, config);
} catch (err) {

Check warning on line 155 in src/app/app-config.service.ts

GitHub Actions / eslint

'err' is defined but never used
console.error("No config provided.");
}
}
selector: "about",
templateUrl: "./about.component.html",
styleUrls: ["./about.component.scss"],
standalone: false,

Check warning on line 8 in src/app/about/about/about.component.ts

GitHub Actions / eslint

Components, Directives and Pipes should not opt out of standalone
})
export class AboutComponent implements OnInit {
appConfig = this.appConfigService.getConfig();
selector: "app-main-app-layout",
templateUrl: "./app-main-layout.component.html",
styleUrls: ["./app-main-layout.component.scss"],
standalone: false,

Check warning on line 7 in src/app/_layout/app-main-layout/app-main-layout.component.ts

GitHub Actions / eslint

Components, Directives and Pipes should not opt out of standalone
})
export class AppMainLayoutComponent {}
selector: "app-app-layout",
templateUrl: "./app-layout.component.html",
styleUrls: ["./app-layout.component.scss"],
standalone: false,

Check warning on line 10 in src/app/_layout/app-layout/app-layout.component.ts

GitHub Actions / eslint

Components, Directives and Pipes should not opt out of standalone
})
export class AppLayoutComponent {
appConfig = this.appConfigService.getConfig();
selector: "app-app-header",
templateUrl: "./app-header.component.html",
styleUrls: ["./app-header.component.scss"],
standalone: false,

Check warning on line 22 in src/app/_layout/app-header/app-header.component.ts

GitHub Actions / eslint

Components, Directives and Pipes should not opt out of standalone
})
export class AppHeaderComponent implements OnInit {
config = this.appConfigService.getConfig();