28 lines
912 B
Docker
28 lines
912 B
Docker
|
# Use the official Nginx image as the base image
|
||
|
FROM nginx:latest
|
||
|
|
||
|
# Copy custom Nginx configuration for client-side routing
|
||
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||
|
|
||
|
# Clear the default Nginx web content folder
|
||
|
RUN rm -rf /usr/share/nginx/html/*
|
||
|
|
||
|
# Install Git
|
||
|
RUN apt-get update && apt-get install -y git
|
||
|
|
||
|
# Set the working directory to the Nginx web content folder
|
||
|
WORKDIR /usr/share/nginx/html
|
||
|
|
||
|
# Clone the content of the specified GitHub repository
|
||
|
RUN git clone https://gitty.informatik.hs-mannheim.de/Maradona/FrontendDist .
|
||
|
|
||
|
# Expose port 80
|
||
|
EXPOSE 80
|
||
|
|
||
|
# Create a script to perform git pull on startup
|
||
|
RUN echo "#!/bin/sh" > /usr/share/nginx/html/update.sh && \
|
||
|
echo "cd /usr/share/nginx/html && git pull" >> /usr/share/nginx/html/update.sh && \
|
||
|
chmod +x /usr/share/nginx/html/update.sh
|
||
|
|
||
|
# Start Nginx and run the update script
|
||
|
CMD /usr/share/nginx/html/update.sh && nginx -g 'daemon off;'
|