-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
49 lines (33 loc) · 893 Bytes
/
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
ARG TTS_FE_VARS_METHOD=dotenv
# build
FROM node:21-alpine3.19 AS build
RUN mkdir -p /usr/src/tts-fe
WORKDIR /usr/src/tts-fe
COPY .*rc ./
COPY *.json ./
COPY .prettier* ./
COPY *.config.js ./
COPY *.config.ts ./
RUN npm install
COPY public/ public/
COPY src/ src/
COPY index.html ./
# dev
FROM build AS dev
EXPOSE $PORT
CMD ["npm", "run", "dev"]
# prod-build-with-dotenv
FROM build AS prod-build-with-dotenv
ARG TTS_FE_DOTENV_FILE=.env.production
COPY ${TTS_DOTENV_FILE} .env.production
# prod-build-with-var
FROM build AS prod-build-with-content-var
ARG TTS_FE_VARS_CONTENT
RUN echo "${TTS_FE_VARS_CONTENT}" | base64 -d > .env.production
# prod-build
FROM prod-build-with-${TTS_FE_VARS_METHOD} AS prod-build
RUN npm run build
# prod
FROM nginx:alpine AS prod
COPY --from=prod-build /usr/src/tts-fe/build /usr/share/nginx/html
COPY nginx.tts.conf /etc/nginx/conf.d/default.conf