Commit ae11cbba authored by Diego Molteni's avatar Diego Molteni
Browse files

Merge branch 'trusted-slb/dm3/dockers' into 'master'

Updated base docker images

See merge request !73
parents 05ce55cb 96903fa9
Pipeline #39474 passed with stages
in 6 minutes and 9 seconds
......@@ -4,27 +4,26 @@ This folder contains a set of [docker](https://www.docker.com/) images to build
- `builder.Dockerfile`, creates the build image to use in the runtime.Docker to build the final distribution. The dockerfile requires 1 user parameter:
- `nodesecure_version`: node package version from [nodesecure repo](https://github.com/nodesource/distributions) for example 8, 10 or 12 etc... (default=10).
- `nodesecure_version`: node package version from [nodesecure repo](https://github.com/nodesource/distributions) for example 8, 10 or 12 etc... (default=10).
```bash
# execute this script from the repository root directory
docker build -f .\docker\builder.Dockerfile -t <builder-image-name> --build-arg nodesecure_version=<node-version> .
# example using ACR private registry
az acr login -n <acr_name>
docker build -f .\docker\builder.Dockerfile -t <acr_name>.azurecr.io/seistore-svc/<builder-image-name>:<builder-image-version> --build-arg nodesecure_version=<node-version> .
```
```bash
# execute this script from the repository root directory
docker build -f .\docker\builder.Dockerfile -t <builder-image-name> --build-arg nodesecure_version=<node-version> .
# example using ACR private registry
az acr login -n <acr_name>
docker build -f .\docker\builder.Dockerfile -t <acr_name>.azurecr.io/seistore-svc/<builder-image-name>:<builder-image-version> --build-arg nodesecure_version=<node-version> .
```
- `runtime.Dockerfile`, builds the distribution and create the final image to use in a runtime env. The dockerfile require 2 arguments:
- `docker_builder_image`, a builder image to build the typescript service, it can be build with the previous builder.Dockerfile image.
- `docker_node_image_version`, the image version of the node docker image to use for the final distribution image. It must be capable to host and execute a nodejs application, for example **10.15.3**(default value) that corresponds to node:10.15.3
```bash
# execute this script from the repository root directory
docker build -f .\docker\builder.Dockerfile -t <runtime-image-name> --build-arg docker_builder_image=<builder-image-name> --build-arg docker_node_image_version=<node-image-version> .
# example using ACR private registry
az acr login -n <acr_name>
docker build -f .\docker\runtime.Dockerfile -t <acr_name>.azurecr.io/seistore-svc/<runtime-image-name>:<runtime-image-version> --build-arg docker_builder_image=<acr_name>.azurecr.io/seistore-svc/<builder-image-name>:<builder-image-version> --build-arg docker_node_image_version=<node-image-version> .
```
- `docker_builder_image`, a builder image to build the typescript service, it can be build with the previous builder.Dockerfile image.
- `docker_node_image_version`, the image version of the node docker image to use for the final distribution image. It must be capable to host and execute a nodejs application, for example **10.15.3**(default value) that corresponds to node:10.15.3
```bash
# execute this script from the repository root directory
docker build -f .\docker\builder.Dockerfile -t <runtime-image-name> --build-arg docker_builder_image=<builder-image-name> --build-arg docker_node_image_version=<node-image-version> .
# example using ACR private registry
az acr login -n <acr_name>
docker build -f .\docker\runtime.Dockerfile -t <acr_name>.azurecr.io/seistore-svc <runtime-image-name>:<runtime-image-version> --build-arg docker_builder_image=<acr_name>.azurecr.io/seistore-svc <builder-image-name>:<builder-image-version> --build-arg docker_node_image_version=<node-image-version> .
```
\ No newline at end of file
# ============================================================================
# Copyright 2017-2019, Schlumberger
# Copyright 2017-2021, Schlumberger
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
......
# ============================================================================
# Copyright 2017-2019, Schlumberger
# Copyright 2017-2021, Schlumberger
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
......@@ -14,25 +14,38 @@
# limitations under the License.
# ============================================================================
# [seistore runtime image]
ARG docker_node_image_version=14-alpine
ARG docker_node_image_version=12.18.2
ARG docker_builder_image
# build the service (require builder image)
FROM ${docker_builder_image} as runtime-builder
# -------------------------------
# Compilation stage
# -------------------------------
FROM node:${docker_node_image_version} as runtime-builder
ADD ./ /service
WORKDIR /service
RUN npm run clean && rm -rf node_modules && rm -rf artifact && mkdir artifact
RUN npm install
RUN npm run build
RUN cp -r package.json npm-shrinkwrap.json dist artifact
RUN apk --no-cache add --virtual native-deps g++ gcc libgcc libstdc++ linux-headers make python \
&& npm install --quiet node-gyp -g \
&& npm install --quiet \
&& npm run build \
&& mkdir artifact \
&& cp -r package.json npm-shrinkwrap.json dist artifact \
&& apk del native-deps
# Create the runtime image (require base image)
# -------------------------------
# Package stage
# -------------------------------
FROM node:${docker_node_image_version} as release
COPY --from=runtime-builder /service/artifact /seistore-service
WORKDIR /seistore-service
RUN npm install --production
ENTRYPOINT ["node", "./dist/server/server-start.js"]
RUN apk --no-cache add --virtual native-deps g++ gcc libgcc libstdc++ linux-headers make python \
&& addgroup appgroup \
&& adduser --disabled-password --gecos --shell appuser --ingroup appgroup \
&& chown -R appuser:appgroup /seistore-service \
&& echo '%appgroup ALL=(ALL) NOPASSWD: /usr/bin/npm' >> /etc/sudoers \
&& echo '%appgroup ALL=(ALL) NOPASSWD: /usr/bin/node' >> /etc/sudoers \
&& npm install --production --quiet \
&& apk del native-deps
ENTRYPOINT ["node", "./dist/server/server-start.js"]
\ No newline at end of file
......@@ -161,15 +161,17 @@ export class Server {
// tslint:disable-next-line
console.log(`- Server is listening on port ${this.port}...`);
});
this.httpsServer.keepAliveTimeout = 65 * 1000;
this.httpsServer.headersTimeout = 66 * 1000;
this.httpsServer.setTimeout(610000);
this.httpsServer.keepAliveTimeout = 610 * 1000;
this.httpsServer.headersTimeout = 611 * 1000;
} else {
this.httpServer = this.app.listen(this.port, () => {
// tslint:disable-next-line
console.log(`- Server is listening on port ${this.port}...`);
});
this.httpServer.keepAliveTimeout = 65 * 1000;
this.httpServer.headersTimeout = 66 * 1000;
this.httpServer.setTimeout(610000);
this.httpServer.keepAliveTimeout = 610 * 1000;
this.httpServer.headersTimeout = 611 * 1000;
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment