From a36f9a1852a31701f4ea473e0fae6b640d02c5b2 Mon Sep 17 00:00:00 2001 From: Randy Date: Wed, 3 Aug 2022 00:21:43 +0800 Subject: [PATCH] Revert "Optimize Dockerfile to reduce image size" --- .github/workflows/ci.yml | 71 ---------------------------------------- Dockerfile | 20 +++-------- yarn.lock | 14 ++++---- 3 files changed, 11 insertions(+), 94 deletions(-) delete mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 4d561614..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: CI Test - -on: - pull_request: - branches: - - master - - dev - paths-ignore: - - '**.md' - -jobs: - image-test: - name: Image Test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Lower case for ghcr - id: ghcr_string - uses: ASzc/change-string-case-action@v1 - with: - string: ${{ github.event.repository.full_name }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Cache Docker layers - uses: actions/cache@v2 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildx- - - - name: Build image for testing - uses: docker/build-push-action@v2 - with: - context: . - platforms: linux/amd64 - load: true - tags: | - ${{ steps.ghcr_string.outputs.lowercase }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache-new - - - name: Move cache - run: | - rm -rf /tmp/.buildx-cache - mv /tmp/.buildx-cache-new /tmp/.buildx-cache - - - name: Install trivy - run: | - wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | sudo apt-key add - - echo deb https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main | sudo tee -a /etc/apt/sources.list.d/trivy.list - sudo apt-get update - sudo apt-get install trivy -y - - - name: Scan for CVEs - uses: mathiasvr/command-output@v1 - id: trivy - with: - run: | - trivy image --no-progress --severity "HIGH,CRITICAL" ${{ steps.ghcr_string.outputs.lowercase }} - - - name: Comment CVE info on PR - uses: thollander/actions-comment-pull-request@v1 - with: - message: | - ``` - ${{ steps.trivy.outputs.stdout }} - ``` - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index f57e6806..4ad398ae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:16-alpine3.15 as builder +FROM node:15.14.0-alpine3.10 VOLUME [ "/data" ] @@ -7,28 +7,16 @@ ENV DB_TYPE=$DB_TYPE RUN apk add --no-cache python3 py3-pip make gcc g++ -COPY . /app - COPY package.json yarn.lock /app/ WORKDIR /app -RUN yarn install --frozen-lockfile && npx browserslist@latest --update-db -RUN npm run build:without-migrate - -FROM node:16-alpine3.15 as runner +RUN yarn -ENV NODE_ENV=production -ARG DB_TYPE=sqlite -ENV DB_TYPE=$DB_TYPE - -WORKDIR /app - -COPY --from=builder /app/node_modules ./node_modules -COPY --from=builder /app/public ./public -COPY --from=builder /app/.next ./.next COPY . /app +RUN npm run build:without-migrate + EXPOSE 3000/tcp CMD ["npm", "run", "start:with-migrate"] \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index beb4f44a..178a7f96 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4588,10 +4588,10 @@ react-hook-form@^7.1.1: resolved "https://registry.yarnpkg.com/react-hook-form/-/react-hook-form-7.2.1.tgz#99b3540dd2314499df12e9a53c70587ad63a806c" integrity sha512-QopAubhVofqQrwlWLr9aK0DF8tNU8fnU8sJIlw1Tb3tGkEvP9yeaA+cx1hlxYni8xBswtHruL1WcDEa6CYQDow== -react-icons@^4.3.1: - version "4.3.1" - resolved "https://registry.yarnpkg.com/react-icons/-/react-icons-4.3.1.tgz#2fa92aebbbc71f43d2db2ed1aed07361124e91ca" - integrity sha512-cB10MXLTs3gVuXimblAdI71jrJx8njrJZmNMEMC+sQu5B/BIOmlsAjskdqpn81y8UBVEGuHODd7/ci5DvoSzTQ== +react-icons@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/react-icons/-/react-icons-4.2.0.tgz#6dda80c8a8f338ff96a1851424d63083282630d0" + integrity sha512-rmzEDFt+AVXRzD7zDE21gcxyBizD/3NqjbX6cmViAgdqfJ2UiLer8927/QhhrXQV7dEj/1EGuOTPp7JnLYVJKQ== react-is@17.0.2: version "17.0.2" @@ -5469,9 +5469,9 @@ typeorm@^0.2.30: zen-observable-ts "^1.0.0" typescript@^4.1.3: - version "4.7.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235" - integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ== + version "4.2.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.4.tgz#8610b59747de028fda898a8aef0e103f156d0961" + integrity sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg== typescript@~4.1.3: version "4.1.5"