Skip to content

Commit 2ad465c

Browse files
committed
chore(docker): add docker
1 parent d5bf81b commit 2ad465c

20 files changed

+1223
-1230
lines changed

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.js

.eslintrc.js

+2
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,7 @@ module.exports = {
3030
'jsx-a11y/no-static-element-interactions': 'off',
3131
'jsx-a11y/mouse-events-have-key-events': 'off',
3232
'jsx-a11y/anchor-is-valid': 'off',
33+
'jsx-a11y/label-has-associated-control': 'off',
34+
'jsx-a11y/accessible-emoji': 'off',
3335
}
3436
};

Dockerfile

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM node:12-alpine AS base
2+
WORKDIR /base
3+
COPY package*.json ./
4+
RUN npm install
5+
COPY . .
6+
7+
FROM base AS build
8+
ENV NODE_ENV=production
9+
WORKDIR /build
10+
COPY --from=base /base ./
11+
RUN npm run build
12+
13+
FROM node:12-alpine AS production
14+
ENV NODE_ENV=production
15+
WORKDIR /app
16+
COPY --from=build /build/package*.json ./
17+
COPY --from=build /build/.next ./.next
18+
COPY --from=build /build/public ./public
19+
RUN npm install next
20+
21+
EXPOSE 3000
22+
CMD npm run start

deploy.sh

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
APP_NAME='blobs'
2+
DOCKER_ADDRESS='http://172.50.12.1:8080'
3+
sudo service nginx stop
4+
sudo certbot certonly --standalone -d $APP_NAME.xom9ik.com --staple-ocsp -m xom9ik.code@gmail.com --agree-tos
5+
echo "server {
6+
server_name $APP_NAME.xom9ik.com;
7+
client_max_body_size 10M;
8+
9+
gzip on;
10+
gzip_disable \"msie6\";
11+
12+
gzip_comp_level 6;
13+
gzip_min_length 1100;
14+
gzip_buffers 16 8k;
15+
gzip_proxied any;
16+
gzip_types
17+
text/plain
18+
text/css
19+
text/js
20+
text/xml
21+
text/javascript
22+
application/javascript
23+
application/x-javascript
24+
application/json
25+
application/xml
26+
application/rss+xml
27+
image/svg+xml/javascript;
28+
29+
location / {
30+
proxy_pass $DOCKER_ADDRESS;
31+
proxy_http_version 1.1;
32+
proxy_set_header Upgrade \$http_upgrade;
33+
proxy_set_header Connection 'upgrade';
34+
proxy_set_header Host \$host;
35+
proxy_cache_bypass \$http_upgrade;
36+
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
37+
proxy_set_header X-Real-IP \$remote_addr;
38+
}
39+
40+
listen 443 ssl http2; # managed by Certbot
41+
ssl_certificate /etc/letsencrypt/live/$APP_NAME.xom9ik.com/fullchain.pem; # managed by Certbot
42+
ssl_certificate_key /etc/letsencrypt/live/$APP_NAME.xom9ik.com/privkey.pem; # managed by Certbot
43+
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
44+
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
45+
}
46+
47+
server {
48+
server_name $APP_NAME.xom9ik.com;
49+
listen 80;
50+
listen [::]:80;
51+
return 301 https://\$host\$request_uri;
52+
}" > /etc/nginx/sites-enabled/$APP_NAME.conf
53+
sudo service nginx start
54+
sh ./rebuild.sh

docker-compose.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: "3.5"
2+
services:
3+
blobs-prod:
4+
image: blobs-prod
5+
container_name: blobs-prod
6+
build:
7+
context: ./
8+
dockerfile: Dockerfile
9+
ports:
10+
- "172.50.12.1:8080:3000"
11+
networks:
12+
blobs-prod_net:
13+
ipv4_address: 172.50.12.11
14+
15+
networks:
16+
blobs-prod_net:
17+
ipam:
18+
driver: default
19+
config:
20+
- subnet: "172.50.12.0/24"

next.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
const path = require('path')
1+
const path = require('path');
22

33
module.exports = {
44
sassOptions: {
55
includePaths: [path.join(__dirname, 'styles')],
66
},
7-
}
7+
};

package-lock.json

+21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"react-dom": "^16.12.0",
2323
"react-redux": "^7.2.2",
2424
"react-tooltip": "^4.2.10",
25+
"react-use-clipboard": "1.0.7",
2526
"react-useportal": "^1.0.13",
2627
"redux": "^4.0.5",
2728
"redux-actions": "^2.6.5",

0 commit comments

Comments
 (0)