🏗 Improve Docker image size
Tim Izzo tim@octree.ch
Wed, 01 Jul 2020 16:10:29 +0200
2 files changed,
12 insertions(+),
3 deletions(-)
M
Dockerfile
→
Dockerfile
@@ -1,3 +1,4 @@
+# Build stage FROM strapi/base:12-alpine ARG NPM_REGISTRY=https://npm-8ee.hidora.com/@@ -5,8 +6,7 @@ ENV NODE_ENV production
WORKDIR /srv/app RUN apk add --no-cache git -RUN npm set registry $NPM_REGISTRY && \ - npm install -g strapi@latest +RUN npm set registry $NPM_REGISTRY ## Install dependencies COPY . /srv/app/@@ -22,4 +22,12 @@ npm run build && \
mv build ../public && \ cd .. && rm -rf app -CMD ["strapi", "start"] +# Prod stage +FROM strapi/base:12-alpine + +ENV NODE_ENV production +WORKDIR /srv/app + +COPY --from=0 /srv/app . + +CMD ["npm", "start"]
M
app/src/containers/CarColumns/index.js
→
app/src/containers/CarColumns/index.js
@@ -23,6 +23,7 @@ {
breakpoint: 600, settings: { slidesToShow: 1, + initialSlide: 1, }, }, {