Skip to content

Commit

Permalink
feat: add docker files
Browse files Browse the repository at this point in the history
  • Loading branch information
menitz committed Jun 1, 2024
1 parent 7073e2a commit 403832f
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 0 deletions.
40 changes: 40 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Use Node.js 20
FROM node:20

# Set the working directory
WORKDIR /app

# Copy package.json and package-lock.json
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY frontend/package.json frontend/
COPY api/package.json api/
COPY shared/package.json shared/

ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"

# Install pnpm 8
RUN npm install -g pnpm@8

# Install dependencies
RUN pnpm install

# Copy all files to the container
COPY . .

# Check formatting
RUN pnpm run format-check

# Build the app
RUN pnpm run build

# Expose the port
EXPOSE 5173

ENV PORT 5173
# set hostname to localhost
ENV HOSTNAME "0.0.0.0"

# Start the app
CMD ["pnpm", "dev:web"]

40 changes: 40 additions & 0 deletions Dockerfile_copy
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Use Node.js 20
FROM node:20

# Set the working directory
WORKDIR /app

# Copy package.json and package-lock.json
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY frontend/package.json frontend/
COPY api/package.json api/
COPY shared/package.json shared/

ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"

# Install pnpm 8
RUN npm install -g pnpm@8

# Install dependencies
RUN pnpm install

# Copy all files to the container
COPY . .

# Check formatting
RUN pnpm run format-check

# Build the app
RUN pnpm run build

# Expose the port
EXPOSE 3000

ENV PORT 3000
# set hostname to localhost
ENV HOSTNAME "0.0.0.0"

# Start the app
CMD ["pnpm", "dev:api"]

23 changes: 23 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,26 @@ services:
- POSTGRES_DB=hkrecruitment
ports:
- '5432:5432'


web:
build:
context: .
dockerfile: Dockerfile
env_file:
- .env
ports:
- '5173:5173'
depends_on:
- db

api:
build:
context: .
dockerfile: Dockerfile_copy
env_file:
- .env
ports:
- '3000:3000'
depends_on:
- db

0 comments on commit 403832f

Please sign in to comment.