Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
78 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# --- Backend Build Stage --- | ||
FROM python:3.9-slim as backend | ||
|
||
WORKDIR /app | ||
|
||
# Install git and Poetry | ||
RUN apt-get update && apt-get install -y git \ | ||
&& pip install poetry | ||
|
||
# Clone the repository from GitHub | ||
RUN git clone https://github.com/your-username/your-repo.git . | ||
|
||
# Change to the backend directory | ||
WORKDIR /app/backend | ||
|
||
# Install dependencies without creating a virtual environment | ||
RUN poetry config virtualenvs.create false \ | ||
&& poetry install --no-dev --no-interaction --no-ansi | ||
|
||
# --- Frontend Build Stage --- | ||
FROM node:14 as frontend | ||
|
||
WORKDIR /app | ||
|
||
# Install git | ||
RUN apt-get update && apt-get install -y git | ||
|
||
# Clone the repository from GitHub | ||
RUN git clone https://github.com/TobiasSchaeuble-EH/LunchHeroes.git . | ||
|
||
# Change to the frontend directory | ||
WORKDIR /app/frontend | ||
|
||
# Install dependencies | ||
RUN npm install | ||
|
||
# Build the frontend | ||
RUN npm run build | ||
|
||
# --- Nginx Stage --- | ||
FROM nginx:alpine | ||
|
||
# Copy the built frontend files to the Nginx server | ||
COPY --from=frontend /app/frontend/build /usr/share/nginx/html | ||
|
||
# Copy the backend app to a directory served by Gunicorn | ||
COPY --from=backend /app/backend /app | ||
|
||
# Set up Gunicorn to serve the backend app | ||
COPY docker/gunicorn.conf /etc/gunicorn/gunicorn.conf | ||
|
||
# Set up Nginx to proxy requests to Gunicorn | ||
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf | ||
|
||
# Expose the necessary ports | ||
EXPOSE 80 | ||
|
||
# Start Gunicorn and Nginx | ||
CMD ["sh", "-c", "gunicorn -c /etc/gunicorn/gunicorn.conf app:app & nginx -g 'daemon off;'"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters