Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
chore: add dockerfile for express server (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-hirano-ist authored Nov 14, 2023
1 parent 8213151 commit 6a18657
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
9 changes: 8 additions & 1 deletion compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ services:
container_name: rss-graphql-db
build:
context: .
dockerfile: db.Dockerfile
volumes:
- rss-graphql-db-data:/var/lib/postgresql/data
ports:
Expand All @@ -14,6 +15,12 @@ services:
POSTGRES_PASSWORD: ${PASSWORD}
POSTGRES_DB: rss-graphql-db
restart: always

server:
container_name: rss-graphql-server
build:
context: .
dockerfile: server.Dockerfile
ports:
- 4000:4000
volumes:
rss-graphql-db-data:
File renamed without changes.
25 changes: 25 additions & 0 deletions server.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# REF: https://pnpm.io/docker

FROM node:20-slim AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"

# this is necessary in prisma
RUN apt-get update -y && apt-get install -y openssl

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
RUN pnpm run build

FROM base
COPY --from=prod-deps /app/node_modules /app/node_modules
COPY --from=build /app/dist /app/dist
EXPOSE 4000
CMD [ "pnpm", "start" ]

0 comments on commit 6a18657

Please sign in to comment.