-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (46 loc) · 2.11 KB
/
Dockerfile
File metadata and controls
53 lines (46 loc) · 2.11 KB
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
# lightweight static server using lighttpd to serve zapp-components/dist
FROM alpine:3.20
# Install lighttpd
RUN apk add --no-cache lighttpd
# Create runtime dirs
RUN mkdir -p /var/log/lighttpd /run/lighttpd /var/www/localhost/htdocs
# Copy build artifacts into the document root
# Ensure your build context contains zapp-components/dist
COPY zapp-components/dist/ /var/www/localhost/htdocs/
COPY zapp-iframe/build/ /var/www/localhost/htdocs/zapp-iframe
# Set sane permissions
RUN chown -R lighttpd:lighttpd /var/www/localhost/htdocs /var/log/lighttpd /run/lighttpd
# Minimal lighttpd config: serve from /var/www/localhost/htdocs and log to stdout/stderr
RUN printf '%s\n' \
'server.document-root = "/var/www/localhost/htdocs"' \
'server.port = 80' \
'server.username = "lighttpd"' \
'server.groupname = "lighttpd"' \
'server.modules = (' \
' "mod_indexfile",' \
' "mod_access",' \
' "mod_alias",' \
' "mod_accesslog"' \
')' \
'server.modules += ( "mod_setenv" )' \
'setenv.add-response-header = (' \
' "Access-Control-Allow-Origin" => "*",' \
" \"Content-Security-Policy\" => \"frame-ancestors \'self\' https://*.zeus.gent https://zeus.gent https://zeus.ugent.be https://*.zeus.ugent.be http://localhost:3000\"," \
' "Access-Control-Allow-Credentials" => "true"' \
')' \
'$HTTP["request-method"] == "OPTIONS" {' \
' setenv.add-response-header = (' \
' "Access-Control-Allow-Methods" => "GET, HEAD, OPTIONS",' \
' "Access-Control-Allow-Headers" => "Origin, X-Requested-With, Content-Type, Accept, Authorization",' \
" \"Content-Security-Policy\" => \"frame-ancestors \'self\' https://*.zeus.gent https://zeus.gent https://zeus.ugent.be https://*.zeus.ugent.be http://localhost:3000\"," \
' "Access-Control-Max-Age" => "86400"' \
' )' \
'}' \
'index-file.names = ( "index.html", "index.htm" )' \
'accesslog.filename = "/dev/stdout"' \
'server.errorlog = "/dev/stderr"' \
'include "mime-types.conf"' \
> /etc/lighttpd/lighttpd.conf
EXPOSE 80
# Run in foreground
CMD ["lighttpd", "-D", "-f", "/etc/lighttpd/lighttpd.conf"]