added frontend docker

This commit is contained in:
2024-04-20 01:44:45 +07:00
parent 054c4f0ea8
commit 4dbb67d5fc
4 changed files with 26 additions and 1 deletions

3
.dockerignore Normal file
View File

@@ -0,0 +1,3 @@
node_modules
.DS_Store
dist

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
node_modules
.DS_Store
dist

21
Dockerfile Normal file
View File

@@ -0,0 +1,21 @@
FROM node:20-slim AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
COPY . /app
WORKDIR /app
FROM base AS prod-deps
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
FROM base AS build
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
ARG VUE_APP_API_URL
RUN pnpm run build
FROM base AS app
COPY --from=prod-deps /app/node_modules /app/node_modules
COPY --from=build /app/dist /app/dist
RUN pnpm install -g serve
EXPOSE 3000
EXPOSE 3001
CMD [ "serve", "-s", "dist" ]

View File

@@ -1,3 +1,3 @@
export const CONFIG = {
api_url: "http://localhost:3000",
api_url: process.env.VUE_APP_API_URL || "http://localhost:3000",
};