-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
45 lines (29 loc) · 1.13 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
# syntax=docker/dockerfile:1
FROM python:3.12
WORKDIR /app
RUN apt-get -y update;\
apt-get -y upgrade;\
apt-get -y install nginx
COPY requirements.txt .
RUN pip install --requirement requirements.txt
COPY api api
COPY config config
COPY frontend frontend
COPY models models
# Sets up the web server for deployment
RUN <<HEREDOC_END
export SITE_CONFIG_NAME=Hbnb.conf
# Add Hbnb site configuration to Nginx sites
mv config/"$SITE_CONFIG_NAME" /etc/nginx/sites-available/"$SITE_CONFIG_NAME"
# Enable Hbnb site
ln -sf /etc/nginx/sites-available/"$SITE_CONFIG_NAME" \
/etc/nginx/sites-enabled/"$SITE_CONFIG_NAME"
# Disable the default Nginx site
rm /etc/nginx/sites-enabled/default
HEREDOC_END
COPY data/Hbnb_FileStorage.json data/Hbnb_FileStorage.json
ENV HBNB_TYPE_STORAGE='file'
# This should match [[services]] > internal_port in fly.toml and the Hbnb site's Nginx configuration:
EXPOSE 8080
# Specifying Bash as the interpreter makes it clear what's wrong if the file accidentally contains CRLF. Exec makes the shell process the main process, so that signals are properly handled.
CMD exec bash ./config/docker_entrypoint.sh