-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
46 lines (35 loc) · 1.26 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
FROM nginx:stable
LABEL maintainer="Ilia Tivin <[email protected]>"
RUN apt-get update && apt-get install -y \
openssl \
git \
bash \
wget \
socat \
python3 \
python3-pip \
cron
# Clone the acme.sh repo into the /root/.acme.sh directory and install it
RUN git clone https://github.com/acmesh-official/acme.sh.git && \
cd acme.sh && \
./acme.sh --install --force --home /root/.acme.sh # Specify the home directory for acme.sh
# Although the --force flag is used, it's recommended to manage SSL renewals properly through cron.
# So, let's ensure the cron service will start with the container and set up the acme.sh renewal job
RUN echo "0 1 * * * /root/.acme.sh/acme.sh --cron --home /root/.acme.sh > /dev/null" > /etc/crontab
# Install Lexicon for DNS challenges
RUN pip3 install dns-lexicon
# Create necessary directories
RUN mkdir -p /app/config \
&& mkdir -p /app/scripts \
&& mkdir -p /app/sites
# Copy the static site files
COPY sites/ /app/sites/
# Copy the scripts
COPY scripts/generate-nginx-configs.sh /app/scripts/
COPY entrypoint.sh /app/
# Make the scripts executable
RUN chmod +x /app/scripts/*.sh /app/entrypoint.sh
# Expose port 80 and 443
EXPOSE 80 443
# Set the entrypoint
ENTRYPOINT ["/app/entrypoint.sh"]