Skip to content

Commit d1eeafe

Browse files
chore: use self-hosted defaults environment by default (#3025)
1 parent cfd5f2b commit d1eeafe

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

Dockerfile

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@ COPY frontend/package.json frontend/package-lock.json frontend/.npmrc ./frontend
77
COPY frontend/bin/ ./frontend/bin/
88
COPY frontend/env/ ./frontend/env/
99

10-
RUN cd frontend && npm ci --quiet --production
10+
# since ENV is only used for the purposes of copying the correct
11+
# project_${env}.js file to common/project.js, this is a build arg
12+
# which subsequently gets set as an environment variable. This is
13+
# done to avoid confusion since it is not a required run time var.
14+
ARG ENV=selfhosted
15+
RUN cd frontend && ENV=${ENV} npm ci --quiet --production
1116

1217
# Copy the entire project - Webpack puts compiled assets into the Django folder
1318
COPY . .
14-
ENV ENV=prod
1519
ENV STATIC_ASSET_CDN_URL=/static/
1620
RUN cd frontend && npm run bundledjango
1721

frontend/Dockerfile

+6-3
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@ COPY --chown=node:node frontend/package.json frontend/package-lock.json frontend
1111
COPY --chown=node:node frontend/bin/ ./bin/
1212
COPY --chown=node:node frontend/env/ ./env/
1313

14-
RUN npm ci --quiet --production
14+
# since ENV is only used for the purposes of copying the correct
15+
# project_${env}.js file to common/project.js, this is a build arg
16+
# which subsequently gets set as an environment variable. This is
17+
# done to avoid confusion since it is not a required run time var.
18+
ARG ENV=selfhosted
19+
RUN ENV=${ENV} npm ci --quiet --production
1520

1621
COPY --chown=node:node frontend .
1722
COPY .release-please-manifest.json .
18-
ENV ENV=prod
1923
RUN npm run bundle
2024

2125

@@ -26,7 +30,6 @@ USER node
2630
WORKDIR /srv/bt
2731
COPY --from=build --chown=node:node /srv/bt/ .
2832

29-
ENV ENV=prod
3033
ENV NODE_ENV=production
3134

3235
EXPOSE 8080

frontend/env/project_selfhosted.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const globalThis = typeof window === 'undefined' ? global : window
2+
module.exports = global.Project = {
3+
env: 'selfhosted',
4+
5+
// Self Hosted Defaults environment
6+
flagsmith: 'MXSepNNQEacBBzxAU7RagJ',
7+
flagsmithClientAPI: 'https://edge.api.flagsmith.com/api/v1/',
8+
9+
// This is used for Sentry tracking
10+
maintenance: false,
11+
...(globalThis.projectOverrides || {}),
12+
}

0 commit comments

Comments
 (0)