-
Notifications
You must be signed in to change notification settings - Fork 0
/
dockerfile
52 lines (39 loc) · 1.17 KB
/
dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Use a smaller base image
FROM node:alpine AS build
WORKDIR /app
COPY package*.json ./
ARG PUBLIC_RAIBU_URL
ARG RAIBU_DB_URL
ARG RAIBU_EMAIL_HOST
ARG RAIBU_EMAIL_PORT
ARG RAIBU_EMAIL_USER
ARG RAIBU_EMAIL_PASS
ARG RAIBU_ADMIN_PASS
ARG RAIBU_STRIPE_PRIVATE_KEY
ARG PUBLIC_RAIBU_STRIPE_PUBLIC_KEY
ARG RAIBU_STRIPE_WEBHOOK_SECRET
RUN npm install
COPY . .
ENV PUBLIC_RAIBU_URL=${PUBLIC_RAIBU_URL}
ENV RAIBU_DB_URL=${RAIBU_DB_URL}
ENV RAIBU_EMAIL_HOST=${RAIBU_EMAIL_HOST}
ENV RAIBU_EMAIL_PORT=${RAIBU_EMAIL_PORT}
ENV RAIBU_EMAIL_USER=${RAIBU_EMAIL_USER}
ENV RAIBU_EMAIL_PASS=${RAIBU_EMAIL_PASS}
ENV RAIBU_ADMIN_PASS=${RAIBU_ADMIN_PASS}
ENV RAIBU_STRIPE_PRIVATE_KEY=${RAIBU_STRIPE_PRIVATE_KEY}
ENV PUBLIC_RAIBU_STRIPE_PUBLIC_KEY=${PUBLIC_RAIBU_STRIPE_PUBLIC_KEY}
ENV RAIBU_STRIPE_WEBHOOK_SECRET=${RAIBU_STRIPE_WEBHOOK_SECRET}
RUN npm run build
# Start a new, final image to keep it clean
FROM node:alpine AS production
WORKDIR /app
# Copy only the built app and the package files
COPY --from=build /app/build .
COPY package*.json ./
# Install only production dependencies
RUN npm install --production
# Expose the port the app runs on
EXPOSE 3000
# Start the server
CMD ["node", "index.js"]