Skip to content

Commit 6b91524

Browse files
committed
Add dockerfile for standalone image
1 parent 5a1ea62 commit 6b91524

File tree

3 files changed

+65
-0
lines changed

3 files changed

+65
-0
lines changed

Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM alpine:latest AS build-stage
2+
3+
RUN apk add --no-cache make g++
4+
5+
COPY . /app
6+
7+
RUN make -C /app fclean custom ARG="-static -O3"
8+
9+
#FROM alpine:latest AS production-stage
10+
FROM alpine:latest AS production-stage
11+
12+
COPY --from=build-stage /app/bin/webserv /usr/bin/webserv
13+
COPY --from=build-stage /app/conf/webserv.conf /etc/webserv/
14+
COPY --from=build-stage /app/conf/mime.types /etc/webserv/
15+
COPY --from=build-stage /app/conf/sites-available/default.conf /etc/webserv/sites-available/
16+
17+
RUN mkdir /etc/webserv/sites-enabled
18+
RUN ln -s /etc/webserv/sites-available/default.conf /etc/webserv/sites-enabled/
19+
20+
RUN mkdir -p /var/www/html
21+
COPY --from=build-stage /app/websites/default/index.html /var/www/html/
22+
23+
EXPOSE 8080
24+
25+
CMD ["/usr/bin/webserv"]

conf/sites-available/default.conf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
server {
2+
listen 0.0.0.0:8080;
3+
4+
root /var/www/html;
5+
6+
index index.html index.htm;
7+
}

websites/default/index.html

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<title>Welcome to webserv!</title>
6+
<style>
7+
html {
8+
color-scheme: light dark;
9+
}
10+
11+
body {
12+
width: 35em;
13+
margin: 0 auto;
14+
font-family: Tahoma, Verdana, Arial, sans-serif;
15+
}
16+
</style>
17+
</head>
18+
19+
<body>
20+
<h1>Welcome to webserv!</h1>
21+
<p>If you see this page, the webserv web server is successfully installed and
22+
working. Further configuration is required.</p>
23+
24+
<p>For online documentation and support please refer to
25+
<a href="https://github.com/PythonGermany/42_webserv?tab=readme-ov-file#introduction">github.com</a>.<br />
26+
Commercial support is not available at
27+
<a href="https://github.com/PythonGermany/42_webserv">github.com</a>.
28+
</p>
29+
30+
<p><em>Thank you for using webserv.</em></p>
31+
</body>
32+
33+
</html>

0 commit comments

Comments
 (0)