-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
71 lines (55 loc) · 2.73 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
####################################################################################
# NATS
####################################################################################
FROM debian:latest
EXPOSE 4222 8222 6222
# update packages and install required ones
RUN apt update && apt upgrade -y && apt install -y \
# golang \
# git \
# libssl-dev \
# python-pip \
dnsutils \
&& apt autoclean -y \
&& apt autoremove -y
# apt cleanup
# RUN apt autoclean -y && apt autoremove -y
# build app instead of just publishing
# RUN go get github.com/dioptre/tracker
# RUN go install github.com/dioptre/tracker
# RUN go build
####################################################################################
# ulimit increase (set in docker templats/aws ecs-task-definition too!!)
RUN bash -c 'echo "root hard nofile 16384" >> /etc/security/limits.conf' \
&& bash -c 'echo "root soft nofile 16384" >> /etc/security/limits.conf' \
&& bash -c 'echo "* hard nofile 16384" >> /etc/security/limits.conf' \
&& bash -c 'echo "* soft nofile 16384" >> /etc/security/limits.conf'
# ip/tcp tweaks, disable ipv6
RUN bash -c 'echo "net.core.somaxconn = 8192" >> /etc/sysctl.conf' \
&& bash -c 'echo "net.ipv4.tcp_max_tw_buckets = 1440000" >> /etc/sysctl.conf' \
&& bash -c 'echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf' \
&& bash -c 'echo "net.ipv4.ip_local_port_range = 5000 65000" >> /etc/sysctl.conf' \
&& bash -c 'echo "net.ipv4.tcp_fin_timeout = 15" >> /etc/sysctl.conf' \
&& bash -c 'echo "net.ipv4.tcp_window_scaling = 1" >> /etc/sysctl.conf' \
&& bash -c 'echo "net.ipv4.tcp_syncookies = 1" >> /etc/sysctl.conf' \
&& bash -c 'echo "net.ipv4.tcp_max_syn_backlog = 8192" >> /etc/sysctl.conf' \
&& bash -c 'echo "fs.file-max=65536" >> /etc/sysctl.conf'
####################################################################################
WORKDIR /app/nats
ADD . /app/nats
RUN bash -c 'rm /app/nats/temp.conf || exit 0'
####################################################################################
# startup command
CMD ["/usr/bin/nice", "-n", "5", "/app/nats/nats-server", "-c", "seed.conf"]
# Can also clean logs > /dev/null 2>&1
####################################################################################
####################################################################################
#Deploy notes:
#sudo docker build -t nats .
#sudo docker run -p 4222:4222 -p 8222:8222 -p 6222:6222 nats
#aws ecr get-login
#sudo docker login -u AWS -p xxxsdfsdfsdfsdf= -e none https://735245989296.dkr.ecr.eu-central-1.amazonaws.com
#sudo docker images
#sudo docker tag 9b8f5081d3c5 735245989296.dkr.ecr.eu-central-1.amazonaws.com/gls
#sudo docker push 735245989296.dkr.ecr.eu-central-1.amazonaws.com/gls
## sudo docker rmi 9b8f5081d3c5 --force