mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-22 00:26:34 +03:00
chore: optimize docker build
This commit is contained in:
parent
e77df0ca07
commit
ea5029b52d
12
.dockerignore
Normal file
12
.dockerignore
Normal file
|
@ -0,0 +1,12 @@
|
|||
*
|
||||
!src/
|
||||
!config
|
||||
!demo/favicon.png
|
||||
|
||||
!custom.d.ts
|
||||
!typings/styled-patch.d.ts
|
||||
!tsconfig.json
|
||||
!webpack.config.ts
|
||||
|
||||
!package.json
|
||||
!yarn.lock
|
10
Dockerfile
10
Dockerfile
|
@ -9,10 +9,16 @@ FROM node:alpine
|
|||
|
||||
RUN apk update && apk add --no-cache git
|
||||
|
||||
# generate bundle
|
||||
# Install dependencies
|
||||
WORKDIR /build
|
||||
COPY . /build
|
||||
COPY package.json yarn.lock /build/
|
||||
RUN yarn install --frozen-lockfile --ignore-optional --ignore-scripts
|
||||
|
||||
# copy only required for the build files
|
||||
COPY src /build/src
|
||||
COPY webpack.config.ts tsconfig.json custom.d.ts /build/
|
||||
COPY typings/styled-patch.d.ts /build/typings/styled-patch.d.ts
|
||||
|
||||
RUN npm run bundle:standalone
|
||||
|
||||
FROM nginx:alpine
|
||||
|
|
|
@ -17,12 +17,18 @@ const nodeExternals = require('webpack-node-externals')({
|
|||
});
|
||||
|
||||
const VERSION = JSON.stringify(require('./package.json').version);
|
||||
const REVISION = JSON.stringify(
|
||||
require('child_process')
|
||||
.execSync('git rev-parse --short HEAD')
|
||||
.toString()
|
||||
.trim(),
|
||||
);
|
||||
let REVISION;
|
||||
|
||||
try {
|
||||
REVISION = JSON.stringify(
|
||||
require('child_process')
|
||||
.execSync('git rev-parse --short HEAD')
|
||||
.toString()
|
||||
.trim(),
|
||||
);
|
||||
} catch (e) {
|
||||
console.error('Skipping REDOC_REVISION');
|
||||
}
|
||||
|
||||
const BANNER = `ReDoc - OpenAPI/Swagger-generated API Reference Documentation
|
||||
-------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue
Block a user