forked from timmo001/home-panel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
80 lines (71 loc) · 2.12 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
72
73
74
75
76
77
78
79
80
ARG BUILD_FROM=alpine:3.8
# hadolint ignore=DL3006
FROM ${BUILD_FROM}
WORKDIR /usr/src/app
# Copy source files
COPY . .
# Install packages
RUN \
apk add --no-cache \
nodejs-current=9.11.1-r2 \
yarn=1.7.0-r0 \
nginx=1.14.0-r0
# Create nginx directories
RUN mkdir -p /run/nginx && mkdir -p /usr/share/nginx/html
# Move app
RUN rm -Rf /usr/share/nginx/html/* \
&& mv build/* /usr/share/nginx/html \
&& rm -Rf ./*
# Expose outbound ports
EXPOSE 80
EXPOSE 443
# Build arguments
ARG BUILD_ARCH
ARG BUILD_DATE
ARG BUILD_REF
ARG BUILD_VERSION
# Labels
LABEL \
maintainer="Timmo <[email protected]>" \
org.label-schema.description="A touch-compatible web-app for controlling the home" \
org.label-schema.build-date=${BUILD_DATE} \
org.label-schema.name="Home Panel" \
org.label-schema.schema-version="1.0" \
org.label-schema.url="https://git.timmo.xyz/home-panel" \
org.label-schema.usage="https://github.com/timmo001/home-panel/tree/master/README.md" \
org.label-schema.vcs-ref=${BUILD_REF} \
org.label-schema.vcs-url="https://github.com/timmo001/home-panel" \
org.label-schema.vendor="Timmo"
# Set run CMD
CMD \
echo "" \
&& if [ -f /ssl/fullchain.pem ]; then \
echo "Copy enabled SSL nginx config" \
&& echo "server {\
listen 443 ssl http2 default_server;\
listen [::]:443 ssl http2 default_server;\
root /usr/share/nginx/html;\
index index.html;\
server_name 172.0.0.1;\
ssl_certificate /ssl/fullchain.pem;\
ssl_certificate_key /ssl/privkey.pem;\
location / {\
try_files \$uri /index.html;\
}\
}" > /etc/nginx/conf.d/default.conf; \
else \
echo "Copy disabled SSL nginx config" \
&& echo "server {\
listen 80 default_server;\
listen [::]:80 default_server;\
root /usr/share/nginx/html;\
index index.html;\
server_name 172.0.0.1;\
location / {\
try_files \$uri /index.html;\
}\
}" > /etc/nginx/conf.d/default.conf; \
fi \
&& echo "" \
&& echo "Run nginx server.." \
&& nginx -g "daemon off;"