Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3b95d55

Browse files
author
Emile Frey
committed
adding frontend deployment
1 parent 9bf1ae3 commit 3b95d55

File tree

3 files changed

+110
-1
lines changed

3 files changed

+110
-1
lines changed

‎frontend/Dockerfile.deploy‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
###########
2+
# BUILDER #
3+
###########
4+
5+
# pull official base image
6+
FROM node:12.18.3-alpine3.9 as builder
7+
8+
# set work directory
9+
WORKDIR /app
10+
11+
# install dependencies and avoid `node-gyp rebuild` errors
12+
COPY . ./
13+
RUN apk add --no-cache --virtual .gyp \
14+
python \
15+
make \
16+
g++ \
17+
&& npm install \
18+
&& apk del .gyp
19+
20+
# copy our react project
21+
# COPY . /app/
22+
23+
# perform npm build
24+
ARG API_SERVER
25+
ENV REACT_APP_API_SERVER=${API_SERVER}
26+
RUN REACT_APP_API_SERVER=${API_SERVER} \
27+
npm run build
28+
29+
#########
30+
# FINAL #
31+
#########
32+
33+
# ---
34+
FROM fholzer/nginx-brotli:v1.12.2
35+
36+
WORKDIR /etc/nginx
37+
ADD nginx_deploy.conf /etc/nginx/nginx.conf
38+
39+
COPY --from=builder /app/build /usr/share/nginx/html
40+
EXPOSE 8080
41+
CMD ["nginx", "-g", "daemon off;"]

‎frontend/nginx_deploy.conf‎

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
user nginx;
2+
worker_processes 1;
3+
4+
error_log /var/log/nginx/error.log warn;
5+
pid /var/run/nginx.pid;
6+
7+
8+
events {
9+
worker_connections 1024;
10+
}
11+
12+
http {
13+
include /etc/nginx/mime.types;
14+
default_type application/octet-stream;
15+
16+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
17+
'$status $body_bytes_sent "$http_referer" '
18+
'"$http_user_agent" "$http_x_forwarded_for"';
19+
20+
access_log /var/log/nginx/access.log main;
21+
22+
sendfile on;
23+
#tcp_nopush on;
24+
25+
keepalive_timeout 65;
26+
27+
gzip on;
28+
gzip_disable "msie6";
29+
30+
gzip_vary on;
31+
gzip_proxied any;
32+
gzip_comp_level 6;
33+
gzip_buffers 16 8k;
34+
gzip_http_version 1.1;
35+
gzip_types text/plain text/css application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
36+
37+
brotli on;
38+
brotli_types text/plain text/css application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
39+
brotli_static on;
40+
41+
server {
42+
listen 8080;
43+
44+
root /usr/share/nginx/html;
45+
index index.html;
46+
47+
server_name localhost;
48+
49+
location ~* \.(?:manifest|appcache|html?|xml|json)$ {
50+
expires -1;
51+
}
52+
53+
location ~* \.(?:css|js)$ {
54+
try_files $uri =404;
55+
expires 1y;
56+
access_log off;
57+
add_header Cache-Control "public";
58+
}
59+
60+
location ~ ^.+\..+$ {
61+
try_files $uri =404;
62+
}
63+
64+
location / {
65+
try_files $uri $uri/ /index.html;
66+
}
67+
}
68+
}

‎frontend/src/settings.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ export const API_SERVER = API_SERVER_VAL;
1717

1818
export const SESSION_DURATION = 5*3600*1000;
1919

20-
export const APP_NAME = "HelloYou"
20+
export const APP_NAME = "YerfElime"

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /