refactor: ♻️ docker images

This commit is contained in:
AP 2020-05-12 12:16:44 +02:00
parent 69555abfff
commit 6abeb43b11
4 changed files with 30 additions and 21 deletions

View file

@ -11,9 +11,10 @@ RUN apk add --update --no-cache \
# Install app dependencies
COPY package.json .
COPY yarn.lock .
RUN yarn install --silent --prod
RUN yarn add --dev cross-env
RUN npm install --production --silent
# Install dependencies necessary for build and start
RUN npm install -D cross-env typescript @types/react @next/bundle-analyzer
# ---------------
# Build App
@ -27,7 +28,7 @@ COPY --from=build node_modules node_modules
# Bundle app source
COPY . .
RUN yarn build
RUN npm run build
EXPOSE 3000
CMD [ "yarn", "start" ]
CMD [ "npm", "start" ]

View file

@ -1,7 +1,7 @@
# ---------------
# Install Dependencies
# ---------------
FROM arm32v7/node:12-alpine as build
FROM node:12-alpine as build
# Install dependencies neccesary for node-gyp on node alpine
RUN apk add --update --no-cache \
@ -11,9 +11,10 @@ RUN apk add --update --no-cache \
# Install app dependencies
COPY package.json .
COPY yarn.lock .
RUN yarn install --network-timeout 100000 --silent --prod
RUN yarn add --dev cross-env
RUN npm install --production --silent
# Install dependencies necessary for build and start
RUN npm install -D cross-env typescript @types/react @next/bundle-analyzer
# ---------------
# Build App
@ -25,9 +26,12 @@ WORKDIR /app
# Copy dependencies from build stage
COPY --from=build node_modules node_modules
# Rebuild dependency for current arch
RUN npm rebuild ln-service
# Bundle app source
COPY . .
RUN yarn build
RUN npm run build
EXPOSE 3000
CMD [ "yarn", "start" ]
CMD [ "npm", "start" ]

View file

@ -1,7 +1,7 @@
# ---------------
# Install Dependencies
# ---------------
FROM arm64v8/node:12-alpine as build
FROM node:12-alpine as build
# Install dependencies neccesary for node-gyp on node alpine
RUN apk add --update --no-cache \
@ -11,9 +11,10 @@ RUN apk add --update --no-cache \
# Install app dependencies
COPY package.json .
COPY yarn.lock .
RUN yarn install --network-timeout 100000 --silent --prod
RUN yarn add --dev cross-env
RUN npm install --production --silent
# Install dependencies necessary for build and start
RUN npm install -D cross-env typescript @types/react @next/bundle-analyzer
# ---------------
# Build App
@ -25,9 +26,12 @@ WORKDIR /app
# Copy dependencies from build stage
COPY --from=build node_modules node_modules
# Rebuild dependency for current arch
RUN npm rebuild ln-service
# Bundle app source
COPY . .
RUN yarn build
RUN npm run build
EXPOSE 3000
CMD [ "yarn", "start" ]
CMD [ "npm", "start" ]

View file

@ -21,10 +21,10 @@
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
"build:image": "docker build --no-cache -t apotdevin/thunderhub:v0.5.5-amd64 .",
"build:32": "docker build --no-cache -f arm32v7.Dockerfile -t apotdevin/thunderhub:v0.5.5-arm32v7 .",
"build:64": "docker build --no-cache -f arm64v8.Dockerfile -t apotdevin/thunderhub:v0.5.5-arm64v8 .",
"build:manifest": "docker manifest create apotdevin/thunderhub:v0.5.5 apotdevin/thunderhub:v0.5.5-amd64 apotdevin/thunderhub:v0.5.5-arm32v7",
"build:image": "docker build --no-cache -t apotdevin/thunderhub:test-amd64 .",
"build:32": "docker build --no-cache -f arm32v7.Dockerfile -t apotdevin/thunderhub:test-arm32v7 .",
"build:64": "docker build -f arm64v8.Dockerfile -t apotdevin/thunderhub:test-arm64v8 .",
"build:manifest": "docker manifest create apotdevin/thunderhub:test apotdevin/thunderhub:test-amd64 apotdevin/thunderhub:test-arm32v7 apotdevin/thunderhub:test-arm64v8",
"upgrade-latest": "yarn upgrade-interactive --latest"
},
"keywords": [],