Skip to content

Commit

Permalink
Merge pull request #78 from fiit-tp7-2023/docker-image-optimization
Browse files Browse the repository at this point in the history
Optimize docker image
  • Loading branch information
brano-hozza authored Feb 29, 2024
2 parents f6c6236 + cfd3aeb commit fb24bb9
Show file tree
Hide file tree
Showing 5 changed files with 458 additions and 311 deletions.
16 changes: 16 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.git
.nuxt
.output
.vscode
.husky
.github
node_modules

.env.example
.gitignore
README.md
.editorconfig
.eslintrc
reviewpad.yml
.prettierrc
.commitlintrc.js
28 changes: 17 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
FROM node:20.10.0
FROM node:20.10.0-slim as base

RUN apt-get update && apt-get --no-install-recommends install -y ca-certificates fonts-liberation fonts-noto-color-emoji libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils && rm -rf /var/lib/apt/lists/*
RUN mkdir -p /app/
WORKDIR /app/
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
COPY --link . .

RUN npm install -g pnpm
FROM base AS dev
ENV HUSKY=0
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install && pnpm run build

RUN mkdir -p /usr/local/team07/presentation-web/frontend
WORKDIR /usr/local/team07/presentation-web/frontend

COPY . .

RUN pnpm install
RUN pnpm build
FROM base
ENV HUSKY=0
RUN apt update && apt install -y --no-install-recommends libglib2.0-0 libnss3 libdbus-1-3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 libxcomposite1 libxdamage1 libxext6 libxfixes3 libxrandr2 libgbm1 libxkbcommon0 libpango-1.0-0 libcairo2 libasound2 && apt clean
RUN npm pkg delete scripts.prepare
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod
COPY --from=dev /app/.output /app/.output
COPY --from=dev /root/.cache/puppeteer /root/.cache/puppeteer

EXPOSE 3000

CMD [ "node", ".output/server/index.mjs" ]
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '1.0'

networks:
team07:
external: true
Expand Down
21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,35 @@
"lint:fix": "eslint --fix --ext \".ts,.js,.vue\" --ignore-path .gitignore ."
},
"devDependencies": {
"@bg-dev/nuxt-naiveui": "^1.5.2",
"@commitlint/cli": "^18.0.0",
"@css-render/vue3-ssr": "^0.15.12",
"@nuxt/devtools": "latest",
"@nuxt/image": "^1.0.0",
"@nuxtjs/eslint-config-typescript": "^12.1.0",
"@nuxtjs/eslint-module": "^4.1.0",
"@nuxtjs/google-fonts": "^3.0.2",
"@nuxtjs/tailwindcss": "^6.8.1",
"@sidebase/nuxt-auth": "^0.5.0",
"commitlint-config-gitmoji": "^2.3.1",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.1",
"husky": "^8.0.0",
"lint-staged": "^15.0.2",
"nuxt": "^3.7.4",
"nuxt-icon": "^0.5.0",
"prettier": "^3.0.3",
"vue": "^3.3.4",
"vue-router": "^4.2.5"
},
"dependencies": {
"@bg-dev/nuxt-naiveui": "^1.5.2",
"@css-render/vue3-ssr": "^0.15.12",
"@kodadot1/minipfs": "0.4.2-rc.0",
"@nuxt/content": "^2.9.0",
"@nuxt/image": "^1.0.0",
"@sidebase/nuxt-auth": "^0.5.0",
"copy-to-clipboard": "^3.3.3",
"md-to-pdf": "^5.2.4",
"next-auth": "4.21.1"
"next-auth": "4.21.1",
"puppeteer": "^22.3.0",
"nuxt": "^3.7.4",
"nuxt-icon": "^0.5.0",
"@nuxtjs/google-fonts": "^3.0.2",
"@nuxtjs/eslint-module": "^4.1.0",
"@nuxtjs/tailwindcss": "^6.8.1"
},
"husky": {
"hooks": {
Expand Down
Loading

0 comments on commit fb24bb9

Please sign in to comment.