-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
50 lines (37 loc) · 1.06 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
# build image - START
# args without default values
FROM node as builder
ARG VITE_SLACK_APP_SUPABASE_API_URL=default \
VITE_SLACK_APP_SUPABASE_ANON_KEY=default
USER root
ENV YARN_VERSION 4.3.1
ENV YARN_CACHE_FOLDER .yarn/cache
RUN corepack enable yarn
RUN yarn policies set-version $YARN_VERSION \
&& yarn -v
# Create app directory
WORKDIR /usr/src/app
# Install app dependencies
COPY . .
COPY package.json yarn.lock .yarnrc.yml ./
COPY .yarn ./.yarn
COPY apps/ ./apps/
COPY packages/ ./packages/
# important to prefix envvar with 'VITE_' so that is included in the build artifact
ENV VITE_SLACK_APP_SUPABASE_API_URL=$VITE_SLACK_APP_SUPABASE_API_URL
ENV VITE_SLACK_APP_SUPABASE_ANON_KEY=$VITE_SLACK_APP_SUPABASE_ANON_KEY
RUN yarn install
RUN yarn build
# production image - START
FROM node:slim as runner
ENV YARN_CACHE_FOLDER .yarn/cache
ENV NODE_ENV production
# Create app directory
WORKDIR /usr/src/app
# Install app dependencies
COPY --from=builder /usr/src/app/ .
# switch back to non-root user
USER node
EXPOSE 3000
ENV PORT 3000
CMD yarn run:slack-app