Skip to content

Commit

Permalink
[aws] feat: User Profile
Browse files Browse the repository at this point in the history
  • Loading branch information
helloitsdave committed Aug 18, 2024
1 parent 6910e76 commit 0faeedc
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,37 +1,36 @@
# Use an official Node.js runtime based on Alpine Linux as the base image
FROM node:20-alpine

# Install bash
RUN apk add --no-cache bash
FROM node:20-alpine as builder

# Set the working directory inside the container
WORKDIR /usr/src/app

# Copy package.json and package-lock.json to the working directory
COPY package.json yarn.lock ./
# Install dependencies required for the build
RUN apk add --no-cache bash openssl3

# Copy package.json, package-lock.json, and TypeScript configuration files
COPY package.json yarn.lock tsconfig.json ./

# Install the application dependencies
RUN yarn

# Required for prisma
RUN apk add openssl3

# Copy the TypeScript configuration files
COPY tsconfig.json ./

# Copy the application code into the container
COPY . .

# Copy the application code and other necessary files into the container
COPY . ./
COPY wait-for-it.sh wait-for-it.sh

# Make the script executable
RUN chmod +x wait-for-it.sh
# Make the script executable and build the application
RUN chmod +x wait-for-it.sh && \
npx prisma generate && \
yarn build

# Use a new, clean base image for the runtime
FROM node:20-alpine

# Primsa generate
RUN npx prisma generate
WORKDIR /usr/src/app

# Build TypeScript code
RUN yarn build
# Copy only the built artifacts and necessary files from the builder stage
COPY --from=builder /usr/src/app/dist ./dist
COPY --from=builder /usr/src/app/node_modules ./node_modules
COPY --from=builder /usr/src/app/wait-for-it.sh ./wait-for-it.sh

# Expose the port that the application will run on
EXPOSE 5000
Expand Down

0 comments on commit 0faeedc

Please sign in to comment.