File tree 2 files changed +6
-4
lines changed
2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 1
1
FROM node:16.13.0-alpine
2
2
ARG API_URL
3
+ ARG MAPBOX_ACCESS_TOKEN
3
4
4
5
# Based on https://nodejs.org/en/docs/guides/nodejs-docker-webapp/
5
6
@@ -18,9 +19,9 @@ COPY babel.config.js ./
18
19
# Bundle app source
19
20
COPY src ./src
20
21
21
- # Run the scripts defined in package.json
22
+ # Run the scripts defined in package.json using build arguments
22
23
RUN npm install && \
23
- API_URL=$API_URL npm run build
24
+ API_URL=$API_URL MAPBOX_ACCESS_TOKEN=$MAPBOX_ACCESS_TOKEN npm run build
24
25
25
26
EXPOSE 3001
26
27
Original file line number Diff line number Diff line change 1
1
const path = require ( 'path' )
2
- const dotenv = require ( 'dotenv' ) . config ( )
2
+ require ( 'dotenv' ) . config ( )
3
3
const HtmlWebpackPlugin = require ( 'html-webpack-plugin' )
4
4
const { CleanWebpackPlugin } = require ( 'clean-webpack-plugin' )
5
5
const webpack = require ( 'webpack' )
6
6
7
7
const outputDirectory = 'dist/public'
8
8
const apiUrl = typeof process . env . API_URL !== 'undefined' ? process . env . API_URL : 'http://localhost:3001/api/v1'
9
+ const mapboxAccessToken = typeof process . env . MAPBOX_ACCESS_TOKEN !== 'undefined' ? process . env . MAPBOX_ACCESS_TOKEN : 'MAPBOX_ACCESS_TOKEN missing'
9
10
10
11
module . exports = {
11
12
entry : {
@@ -29,7 +30,7 @@ module.exports = {
29
30
} ) ,
30
31
new webpack . DefinePlugin ( {
31
32
'process.env.API_URL' : JSON . stringify ( apiUrl ) ,
32
- 'process.env' : JSON . stringify ( dotenv . parsed )
33
+ 'process.env.MAPBOX_ACCESS_TOKEN ' : JSON . stringify ( mapboxAccessToken )
33
34
} )
34
35
] ,
35
36
output : {
You can’t perform that action at this time.
0 commit comments