-
-
Notifications
You must be signed in to change notification settings - Fork 402
/
Dockerfile
146 lines (130 loc) · 6.42 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# syntax = docker/dockerfile:1
FROM node:20-slim AS base
LABEL fly_launch_runtime="Remix"
# Remix app lives here
WORKDIR /app
# Set production environment
ENV NODE_ENV="production"
ARG YARN_VERSION=3.6.4
# Install Yarn 3
RUN corepack enable && \
yarn set version ${YARN_VERSION}
# Add CircleCI context variables as ARGs
ARG VITE_BRANCH
ARG VITE_CDN_URL
ARG VITE_FIREBASE_API_KEY
ARG VITE_FIREBASE_AUTH_DOMAIN
ARG VITE_FIREBASE_DATABASE_URL
ARG VITE_FIREBASE_MESSAGING_SENDER_ID
ARG VITE_FIREBASE_PROJECT_ID
ARG VITE_FIREBASE_STORAGE_BUCKET
ARG VITE_SENTRY_DSN
ARG VITE_GA_TRACKING_ID
ARG VITE_PATREON_CLIENT_ID
ARG VITE_PLATFORM_PROFILES
ARG VITE_PROJECT_VERSION
ARG VITE_SUPPORTED_MODULES
ARG VITE_ACADEMY_RESOURCE
ARG VITE_API_URL
ARG VITE_PROFILE_GUIDELINES_URL
ARG VITE_SITE_NAME
ARG VITE_THEME
ARG VITE_DONATIONS_BODY
ARG VITE_DONATIONS_IFRAME_SRC
ARG VITE_DONATIONS_IMAGE_URL
ARG VITE_HOWTOS_HEADING
ARG VITE_COMMUNITY_PROGRAM_URL
ARG VITE_QUESTIONS_GUIDELINES_URL
# Throw-away build stage to reduce size of final image
FROM base AS build
# Install packages needed to build node modules
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential node-gyp pkg-config python-is-python3
# Copy source code
ADD . .
# Install packages
RUN yarn install
RUN --mount=type=secret,id=VITE_BRANCH \
--mount=type=secret,id=VITE_CDN_URL \
--mount=type=secret,id=VITE_FIREBASE_API_KEY \
--mount=type=secret,id=VITE_FIREBASE_AUTH_DOMAIN \
--mount=type=secret,id=VITE_FIREBASE_DATABASE_URL \
--mount=type=secret,id=VITE_FIREBASE_MESSAGING_SENDER_ID \
--mount=type=secret,id=VITE_FIREBASE_PROJECT_ID \
--mount=type=secret,id=VITE_FIREBASE_STORAGE_BUCKET \
--mount=type=secret,id=VITE_SENTRY_DSN \
--mount=type=secret,id=VITE_GA_TRACKING_ID \
--mount=type=secret,id=VITE_PATREON_CLIENT_ID \
--mount=type=secret,id=VITE_PROJECT_VERSION \
--mount=type=secret,id=VITE_SUPPORTED_MODULES \
--mount=type=secret,id=VITE_ACADEMY_RESOURCE \
--mount=type=secret,id=VITE_API_URL \
--mount=type=secret,id=VITE_PROFILE_GUIDELINES_URL \
--mount=type=secret,id=VITE_PLATFORM_PROFILES \
--mount=type=secret,id=VITE_SITE_NAME \
--mount=type=secret,id=VITE_THEME \
--mount=type=secret,id=VITE_DONATIONS_BODY \
--mount=type=secret,id=VITE_DONATIONS_IFRAME_SRC \
--mount=type=secret,id=VITE_DONATIONS_IMAGE_URL \
--mount=type=secret,id=VITE_HOWTOS_HEADING \
--mount=type=secret,id=VITE_COMMUNITY_PROGRAM_URL \
--mount=type=secret,id=VITE_QUESTIONS_GUIDELINES_URL \
VITE_CDN_URL="$(cat /run/secrets/VITE_CDN_URL)" && \
VITE_BRANCH="$(cat /run/secrets/VITE_BRANCH)" && \
VITE_FIREBASE_API_KEY="$(cat /run/secrets/VITE_FIREBASE_API_KEY)" && \
VITE_FIREBASE_AUTH_DOMAIN="$(cat /run/secrets/VITE_FIREBASE_AUTH_DOMAIN)" && \
VITE_FIREBASE_DATABASE_URL="$(cat /run/secrets/VITE_FIREBASE_DATABASE_URL)" && \
VITE_FIREBASE_MESSAGING_SENDER_ID="$(cat /run/secrets/VITE_FIREBASE_MESSAGING_SENDER_ID)" && \
VITE_FIREBASE_PROJECT_ID="$(cat /run/secrets/VITE_FIREBASE_PROJECT_ID)" && \
VITE_FIREBASE_STORAGE_BUCKET="$(cat /run/secrets/VITE_FIREBASE_STORAGE_BUCKET)" && \
VITE_SENTRY_DSN="$(cat /run/secrets/VITE_SENTRY_DSN)" && \
VITE_GA_TRACKING_ID="$(cat /run/secrets/VITE_GA_TRACKING_ID)" && \
VITE_PATREON_CLIENT_ID="$(cat /run/secrets/VITE_PATREON_CLIENT_ID)" && \
VITE_PLATFORM_PROFILES="$(cat /run/secrets/VITE_PLATFORM_PROFILES)" && \
VITE_PROJECT_VERSION="$(cat /run/secrets/VITE_PROJECT_VERSION)" && \
VITE_SUPPORTED_MODULES="$(cat /run/secrets/VITE_SUPPORTED_MODULES)" && \
VITE_ACADEMY_RESOURCE="$(cat /run/secrets/VITE_ACADEMY_RESOURCE)" && \
VITE_API_URL="$(cat /run/secrets/VITE_API_URL)" && \
VITE_PROFILE_GUIDELINES_URL="$(cat /run/secrets/VITE_PROFILE_GUIDELINES_URL)" && \
VITE_SITE_NAME="$(cat /run/secrets/VITE_SITE_NAME)" && \
VITE_THEME="$(cat /run/secrets/VITE_THEME)" && \
VITE_DONATIONS_BODY="$(cat /run/secrets/VITE_DONATIONS_BODY)" && \
VITE_DONATIONS_IFRAME_SRC="$(cat /run/secrets/VITE_DONATIONS_IFRAME_SRC)" && \
VITE_DONATIONS_IMAGE_URL="$(cat /run/secrets/VITE_DONATIONS_IMAGE_URL)" && \
VITE_HOWTOS_HEADING="$(cat /run/secrets/VITE_HOWTOS_HEADING)" && \
VITE_COMMUNITY_PROGRAM_URL="$(cat /run/secrets/VITE_COMMUNITY_PROGRAM_URL)" && \
VITE_QUESTIONS_GUIDELINES_URL="$(cat /run/secrets/VITE_QUESTIONS_GUIDELINES_URL)" && \
echo "VITE_CDN_URL=\"${VITE_CDN_URL}\"" >> .env && \
echo "VITE_BRANCH=\"${VITE_BRANCH}\"" >> .env && \
echo "VITE_FIREBASE_API_KEY=\"${VITE_FIREBASE_API_KEY}\"" >> .env && \
echo "VITE_FIREBASE_AUTH_DOMAIN=\"${VITE_FIREBASE_AUTH_DOMAIN}\"" >> .env && \
echo "VITE_FIREBASE_DATABASE_URL=\"${VITE_FIREBASE_DATABASE_URL}\"" >> .env && \
echo "VITE_FIREBASE_MESSAGING_SENDER_ID=\"${VITE_FIREBASE_MESSAGING_SENDER_ID}\"" >> .env && \
echo "VITE_FIREBASE_PROJECT_ID=\"${VITE_FIREBASE_PROJECT_ID}\"" >> .env && \
echo "VITE_FIREBASE_STORAGE_BUCKET=\"${VITE_FIREBASE_STORAGE_BUCKET}\"" >> .env && \
echo "VITE_SENTRY_DSN=\"${VITE_SENTRY_DSN}\"" >> .env && \
echo "VITE_GA_TRACKING_ID=\"${VITE_GA_TRACKING_ID}\"" >> .env && \
echo "VITE_PATREON_CLIENT_ID=\"${VITE_PATREON_CLIENT_ID}\"" >> .env && \
echo "VITE_PLATFORM_PROFILES=\"${VITE_PLATFORM_PROFILES}\"" >> .env && \
echo "VITE_PROJECT_VERSION=\"${VITE_PROJECT_VERSION}\"" >> .env && \
echo "VITE_SUPPORTED_MODULES=\"${VITE_SUPPORTED_MODULES}\"" >> .env && \
echo "VITE_ACADEMY_RESOURCE=\"${VITE_ACADEMY_RESOURCE}\"" >> .env && \
echo "VITE_API_URL=\"${VITE_API_URL}\"" >> .env && \
echo "VITE_PROFILE_GUIDELINES_URL=\"${VITE_PROFILE_GUIDELINES_URL}\"" >> .env && \
echo "VITE_SITE_NAME=\"${VITE_SITE_NAME}\"" >> .env && \
echo "VITE_THEME=\"${VITE_THEME}\"" >> .env && \
echo "VITE_DONATIONS_BODY=\"${VITE_DONATIONS_BODY}\"" >> .env && \
echo "VITE_DONATIONS_IFRAME_SRC=\"${VITE_DONATIONS_IFRAME_SRC}\"" >> .env && \
echo "VITE_DONATIONS_IMAGE_URL=\"${VITE_DONATIONS_IMAGE_URL}\"" >> .env && \
echo "VITE_HOWTOS_HEADING=\"${VITE_HOWTOS_HEADING}\"" >> .env && \
echo "VITE_COMMUNITY_PROGRAM_URL=\"${VITE_COMMUNITY_PROGRAM_URL}\"" >> .env && \
echo "VITE_QUESTIONS_GUIDELINES_URL=\"${VITE_QUESTIONS_GUIDELINES_URL}\"" >> .env
# Build application
RUN yarn run build
# Final stage for app image
FROM base
# Copy built application
COPY --from=build /app /app
# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD [ "yarn", "run", "start" ]