implement frontend into docker
This commit is contained in:
parent
d81233ab42
commit
51e7af4e2f
5 changed files with 38 additions and 7 deletions
2
.env
2
.env
|
@ -1,2 +1,2 @@
|
|||
DATABASE_URL=postgres://apfel:apfel@db:5432/apfel
|
||||
DATABASE_URL=postgres://apfel:apfel@postgres:5432/apfel
|
||||
TOKEN_SECRET=9b2cbd156a7a7e0e530acd780fdd16e8f37fa3fd8122c74a9b7e1ce6fc67980ed0e55572be4e382679a0c13d13f0a651d15e9e877bb579e957c899eb762b1bb4
|
22
Dockerfile-frontend
Normal file
22
Dockerfile-frontend
Normal file
|
@ -0,0 +1,22 @@
|
|||
FROM node:lts-slim AS base
|
||||
|
||||
ENV PNPM_HOME="/pnpm"
|
||||
ENV PATH="$PNPM_HOME:$PATH"
|
||||
RUN corepack enable
|
||||
|
||||
COPY ./web ./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
|
||||
RUN pnpm run buildNoCheck
|
||||
|
||||
|
||||
FROM base
|
||||
COPY --from=prod-deps /app/node_modules /app/node_modules
|
||||
COPY --from=build /app/dist /app/dist
|
||||
EXPOSE 3000
|
||||
CMD [ "pnpm", "start" ]
|
|
@ -1,6 +1,5 @@
|
|||
services:
|
||||
db:
|
||||
container_name: apfelnetzwerk-postgres
|
||||
postgres:
|
||||
image: postgres
|
||||
environment:
|
||||
POSTGRES_DB: apfel
|
||||
|
@ -16,20 +15,29 @@ services:
|
|||
restart: unless-stopped
|
||||
|
||||
backend:
|
||||
container_name: apfelnetzwerk-backend
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
dockerfile: Dockerfile-backend
|
||||
ports:
|
||||
- "8080:8080"
|
||||
networks:
|
||||
- apfelnetzwerk
|
||||
depends_on:
|
||||
- db
|
||||
- postgres
|
||||
env_file:
|
||||
- .env
|
||||
restart: unless-stopped
|
||||
|
||||
frontend:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile-frontend
|
||||
ports:
|
||||
- "3000:3000"
|
||||
depends_on:
|
||||
- backend
|
||||
restart: unless-stopped
|
||||
|
||||
networks:
|
||||
apfelnetzwerk:
|
||||
driver: bridge
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
"dev": "vite --host",
|
||||
"build": "vue-tsc --noEmit && vite build",
|
||||
"buildNoCheck": "vite build",
|
||||
"preview": "vite preview"
|
||||
"preview": "vite preview",
|
||||
"start": "vite preview --port 3000"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mdi/font": "6.2.95",
|
||||
|
|
Loading…
Add table
Reference in a new issue