Skip to content

Commit 8249f0d

Browse files
author
John Dillick
committed
Make build phase of docker image build smaller. Use node user in final image.
1 parent d028cde commit 8249f0d

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

.core/reactium-config.js

+6
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,12 @@ module.exports = {
420420
destination: '/src/app/main.js',
421421
source: '/tmp/update/src/app/main.js',
422422
},
423+
{
424+
overwrite: true,
425+
version: '>=3.6.0',
426+
destination: '/.dockerignore',
427+
source: '/tmp/update/.dockerignore',
428+
},
423429
],
424430
remove: [],
425431
},

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules
2+
reactium_modules
23
npm-debug.log
34
Dockerfile*
45
docker-compose*

Dockerfile

+11-6
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ COPY package*.json ./
1313
# Bundle app source
1414
COPY . .
1515

16-
RUN chown -R node ./
17-
18-
USER node
19-
2016
# Run App build within container context
2117
RUN npx -p @atomic-reactor/cli arcli install && npm run build
2218

@@ -28,10 +24,19 @@ FROM node:lts
2824
# Create app directory
2925
WORKDIR /usr/src/app
3026

31-
COPY --from=build /tmp/app/node_modules ./node_modules
27+
# Includes all build assets
3228
COPY --from=build /tmp/app/public ./public
33-
COPY --from=build /tmp/app/build ./build
29+
30+
# Dependencies of server
3431
COPY --from=build /tmp/app/package.json ./package.json
32+
COPY --from=build /tmp/app/node_modules ./node_modules
33+
34+
# Includes entire server-side app (including reactium_modules)
35+
COPY --from=build /tmp/app/build ./build
36+
37+
RUN chown -R node ./
38+
39+
USER node
3540

3641
EXPOSE 3030
3742

0 commit comments

Comments
 (0)