Improve Dockerfile (#256)
* Use npm ci over install to achive faster and more expectable build results; Split copy package(-lock).json files and ci then to avoid reinstalling dependencies when not needed => Faster build times * Stopp adding wasm type to mime.types, its already there (duplicate): - avoids warning in console - cleans up - might have been missing in past nginx:alpine versions but now exists * Change node tag from alpine and nginx to more specific ones for #260
This commit is contained in:
parent
6d97e5fa5d
commit
1b9216b341
2
.dockerignore
Normal file
2
.dockerignore
Normal file
|
@ -0,0 +1,2 @@
|
|||
node_modules/
|
||||
.git/
|
12
Dockerfile
12
Dockerfile
|
@ -1,20 +1,18 @@
|
|||
## Builder
|
||||
FROM node:14-alpine as builder
|
||||
FROM node:17.4.0-alpine3.15 as builder
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
COPY package.json package-lock.json /src
|
||||
RUN npm ci
|
||||
COPY . /src
|
||||
RUN npm install \
|
||||
&& npm run build
|
||||
RUN npm run build
|
||||
|
||||
|
||||
## App
|
||||
FROM nginx:alpine
|
||||
FROM nginx:1.21.6-alpine
|
||||
|
||||
COPY --from=builder /src/dist /app
|
||||
|
||||
# Insert wasm type into Nginx mime.types file so they load correctly.
|
||||
RUN sed -i '3i\ \ \ \ application/wasm wasm\;' /etc/nginx/mime.types
|
||||
|
||||
RUN rm -rf /usr/share/nginx/html \
|
||||
&& ln -s /app /usr/share/nginx/html
|
||||
|
|
Loading…
Reference in a new issue