-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 changed file
with
26 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,42 @@ | ||
# Stage 01 - Build Vue | ||
FROM node:20 as vue | ||
# Stage 01 - Build Vue Application | ||
FROM node:20 as vue-builder | ||
WORKDIR /app | ||
# Copying package.json and package-lock.json | ||
COPY service/frontend/wand-zero/package*.json ./ | ||
# Installing Node.js dependencies | ||
RUN npm install | ||
# Copying the rest of the frontend application | ||
COPY service/frontend/wand-zero/ . | ||
# Building the Vue application | ||
RUN npm run build | ||
|
||
# Stage 02 - Build FastAPI | ||
FROM python:alpine | ||
# Stage 02 - Build FastAPI Application | ||
FROM python:3.12-alpine as fastapi-builder | ||
WORKDIR /app | ||
|
||
ARG VERSION | ||
ENV WD_VERSION=${VERSION} | ||
# Installing Poetry | ||
RUN apk add --no-cache curl && \ | ||
curl -sSL https://install.python-poetry.org | python3 - && \ | ||
ln -s $HOME/.local/bin/poetry /usr/local/bin/poetry | ||
|
||
COPY service/backend/requirements.txt . | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
# Copying the Python project files | ||
COPY pyproject.toml poetry.lock* ./ | ||
|
||
# Installing Python dependencies with Poetry without creating a virtual environment | ||
RUN poetry config virtualenvs.create false && \ | ||
poetry install --no-dev --no-interaction --no-ansi | ||
|
||
# Copying the FastAPI application code | ||
COPY service/backend . | ||
COPY --from=vue /app/dist /app/app/web | ||
|
||
# Copying the Vue build artifacts from the vue-builder stage | ||
COPY --from=vue-builder /app/dist /app/app/web | ||
|
||
# Preparing the start script and creating a non-root user | ||
COPY start.sh /start.sh | ||
RUN chmod +x /start.sh | ||
RUN adduser --system --no-create-home wand | ||
RUN chmod +x /start.sh && \ | ||
adduser --system --no-create-home wand | ||
|
||
USER wand | ||
EXPOSE 80 | ||
CMD ["/start.sh"] |