diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 56491ec..9a0260a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,41 @@ -FROM node:18 as builder +# syntax=docker/dockerfile:1 +FROM node:22 AS frontend-builder +# Workingdir +WORKDIR /frontend + +# Copy files +COPY frontend/src/ src/ +COPY frontend/package.json . +COPY frontend/index.html . +COPY frontend/tsconfig.json . +COPY frontend/vite.config.js . + +# Install libs +RUN yarn install +# Build to dist/ +RUN yarn build + + +FROM node:22 AS backend-builder + +# Workingdir WORKDIR /app -COPY package.json /app -RUN yarn +COPY package.json . +RUN yarn install + +COPY tsconfig.json . +COPY src/ src/ + +# Build to dist/ +RUN yarn run build +# Final stage +FROM node:22 +COPY --from=frontend-builder /frontend/dist/ /app/frontend/dist +COPY --from=backend-builder /app/dist /app/dist +COPY package.json . + +CMD ["yarn", "run", "start"] diff --git a/frontend/.dockerignore b/frontend/.dockerignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/frontend/.dockerignore @@ -0,0 +1 @@ +node_modules diff --git a/frontend/index.html b/frontend/index.html index 0e19512..7744031 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -8,6 +8,6 @@
- +