Add very basic support for Docker

This commit is contained in:
Joonas 2024-01-06 19:05:30 +02:00
parent fccdfff3fc
commit f0e96cc991
3 changed files with 27 additions and 0 deletions

3
.dockerignore Normal file
View File

@ -0,0 +1,3 @@
.cache/
node_modules/
build

16
Dockerfile Normal file
View File

@ -0,0 +1,16 @@
FROM node:20-alpine
RUN apk add --no-cache openssl
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
WORKDIR /app
COPY ./package.json ./pnpm-lock.yaml ./
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
COPY ./ .
RUN pnpm run build
RUN pnpm prisma generate
RUN pnpm prisma migrate deploy
EXPOSE 3000
CMD ["pnpm", "run" ,"start"]

8
docker-compose.yml Normal file
View File

@ -0,0 +1,8 @@
version: '3.8'
services:
twitter-clone:
container_name: twitter-clone
restart: unless-stopped
build: .
ports:
- 3100:3000