You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
4
+
RUN apk add --no-cache libc6-compat
5
+
WORKDIR /app
6
+
COPY package.json yarn.lock ./
7
+
RUN yarn install --frozen-lockfile
8
+
9
+
# If using npm with a `package-lock.json` comment out above and use below instead
10
+
# COPY package.json package-lock.json ./
11
+
# RUN npm ci
12
+
13
+
# Rebuild the source code only when needed
14
+
FROM node:16-alpine AS builder
15
+
WORKDIR /app
16
+
COPY --from=deps /app/node_modules ./node_modules
17
+
COPY . .
18
+
19
+
# Next.js collects completely anonymous telemetry data about general usage.
20
+
# Learn more here: https://nextjs.org/telemetry
21
+
# Uncomment the following line in case you want to disable telemetry during the build.
22
+
# ENV NEXT_TELEMETRY_DISABLED 1
23
+
RUN NEXT_PUBLIC_PUBLIC_API_URL=APP_NEXT_PUBLIC_API_URL NEXT_PUBLIC_FOOTER_FLAG=APP_PUBLIC_FOOTER_FLAG yarn export
24
+
25
+
# Production image, copy all the files to nginx directory
The frontend proxies requests to the graphQL backend at the path /api. When running locally ensure your `public-api` is running at `http://localhost:8080` or change package.json before running `yarn start`.
10
14
11
15
To run the application using the Docker container you need to add nginx configuration like the following example and mount it at `/etc/nginx/conf.d/default.conf`. Set the backend proxy_add for the api to the location of your server.
12
16
17
+
For the frontend only image:
18
+
13
19
```
14
-
# /etc/nginx/conf.d/default.conf
15
-
server {
16
-
listen 80;
17
-
server_name localhost;
18
-
19
-
#charset koi8-r;
20
-
#access_log /var/log/nginx/host.access.log main;
21
-
22
-
location / {
23
-
root /usr/share/nginx/html;
24
-
index index.html index.htm;
25
-
}
26
-
27
-
# Proxy pass the api location to save CORS
28
-
location /api {
29
-
proxy_pass http://127.0.0.1:18080;
30
-
}
31
-
32
-
error_page 500 502 503 504 /50x.html;
33
-
location = /50x.html {
34
-
root /usr/share/nginx/html;
35
-
}
36
-
}
20
+
docker run -it -p 3000:3000 hashicorpdemoapp/frontend:v1.0.6
37
21
```
38
22
23
+
For the frontend (with nginx) image:
24
+
39
25
```
40
-
docker run -it -p 8080:80 -v $PWD/nginx.conf:/etc/nginx/conf.d/default.conf hasicorpdemoapp/frontend:v0.0.1
26
+
docker run -it -p 80:80 -v $PWD/nginx.conf:/etc/nginx/conf.d/default.conf --env NEXT_PUBLIC_FOOTER_FLAG=test123 hashicorpdemoapp/frontend-nginx
0 commit comments