Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ COPY ./packages/client/ ./
WORKDIR /app
RUN yarn install

#ENVS FOR PROD FRONTEND
ENV APP_ENV "production"
ENV NODE_ENV "production"
ENV REACT_APP_FRONTEND_URL "cast.fyi"
ENV NODE_ENV "production"
ENV REACT_APP_BACK_END_SERVER_API "https://api.cast.fyi"
ENV REACT_APP_IPFS_GATEWAY "https://gateway.pinata.cloud/ipfs/"
ENV REACT_APP_FLOW_ENV "mainnet"
Expand All @@ -22,6 +22,7 @@ RUN yarn build

# DEPLOY CLIENT
FROM nginx:latest as production-stage
RUN mkdir -p /var/run/nginx-cache && chmod 0755 /var/run/nginx-cache
WORKDIR /app
COPY --from=build-stage /app/packages/client/build /app
COPY ./deploy/nginx.conf /etc/nginx/nginx.conf
Expand Down
8 changes: 5 additions & 3 deletions frontend/Dockerfile.stage
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@ COPY ./packages/client/ ./
WORKDIR /app
RUN yarn install

#ENVS FOR DEVELOP FRONTEND
#ENVS FOR STAGING FRONTEND
ENV APP_ENV "production"
ENV NODE_ENV "production"
ENV REACT_APP_FRONTEND_URL "fe.staging.cast.dapperlabs.com"
ENV REACT_APP_BACK_END_SERVER_API "https://app.staging.cast.dapperlabs.com"
ENV REACT_APP_IPFS_GATEWAY "https://gateway.pinata.cloud/ipfs/"
ENV REACT_APP_FLOW_ENV "testnet"
ENV NODE_ENV "production"
ENV REACT_APP_TX_OPTIONS_ADDRS "0xe0de919ed4ebeee4,0x7f81b82fa0e59b17"
ENV REACT_APP_FRONTEND_URL "fe.staging.cast.dapperlabs.com"

RUN yarn build

# DEPLOY CLIENT
FROM nginx:latest as production-stage
RUN mkdir -p /var/run/nginx-cache && chmod 0755 /var/run/nginx-cache
WORKDIR /app
COPY --from=build-stage /app/packages/client/build /app
COPY ./deploy/nginx.conf /etc/nginx/nginx.conf
Expand Down
29 changes: 28 additions & 1 deletion frontend/deploy/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ http {
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;

proxy_cache_path /var/run/nginx-cache/jscache levels=1:2 keys_zone=jscache:100m inactive=30d use_temp_path=off max_size=100m;

server {
listen 80;
server_name localhostx;
Expand All @@ -26,6 +27,32 @@ http {
index index.html;
try_files $uri $uri/ /index.html;
}

location /js/script.js {
# Change this if you use a different variant of the script
proxy_pass https://plausible.io/js/script.js;

# Tiny, negligible performance improvement. Very optional.
proxy_buffering on;

# Cache the script for 6 hours, as long as plausible.io returns a valid response
proxy_cache jscache;
proxy_cache_valid 200 6h;
proxy_cache_use_stale updating error timeout invalid_header http_500;

# Optional. Adds a header to tell if you got a cache hit or miss
add_header X-Cache $upstream_cache_status;
}

location /api/event {
proxy_pass https://plausible.io/api/event;
proxy_buffering on;
proxy_http_version 1.1;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
}

error_page 500 502 503 504 /50x.html;

Expand Down
7 changes: 4 additions & 3 deletions frontend/packages/client/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.

Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>CAST</title>
<script
defer
data-domain="cast.fyi"
src="https://plausible.io/js/plausible.hash.js"
data-api="/api/event"
data-domain="%REACT_APP_FRONTEND_URL%"
src="/js/script.js"
></script>
<script>
window.plausible =
Expand Down