Spaces:
Build error
Build error
File size: 1,569 Bytes
b77940d 818b3c1 b77940d 60f8173 b77940d |
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 47 48 49 50 51 52 53 54 55 56 57 58 |
# Node frontend build
FROM node:18 as builder
WORKDIR /usr/src/app
RUN --mount=type=secret,id=GH_PAT,mode=0444,required=true \
git clone https://TomTom101:$(cat /run/secrets/GH_PAT)@github.com/TomTom101/use-case-voting .
WORKDIR /usr/src/app/frontend
RUN npm install
RUN npm run build
# Main build
FROM python:3.11-slim-bookworm
RUN useradd -m -u 1000 user
ENV POETRY_VERSION=1.6 \
POETRY_VIRTUALENVS_CREATE=false
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
USER root
RUN apt-get update \
&& apt-get install nginx supervisor -y
COPY --from=builder /usr/src/app/frontend/dist /usr/share/nginx/html
COPY --chown=user ./docker/nginx.prod.conf /etc/nginx/sites-available/default
COPY --chown=user ./docker/supervisord.conf /etc/supervisord.conf
# Create nginx folders
RUN mkdir -p /var/cache/nginx \
/var/log/nginx \
/var/lib/nginx
RUN touch /var/run/nginx.pid
RUN chown -R user:user \
/var/cache/nginx \
/var/log/nginx \
/var/lib/nginx \
/var/run/nginx.pid
RUN chown -R user:user $HOME/app
# Install poetry
RUN pip install "poetry==$POETRY_VERSION"
COPY --from=builder /usr/src/app/poetry.lock /usr/src/app/pyproject.toml /usr/src/app/README.md ./
# Project initialization:
RUN poetry install --no-cache --no-interaction --no-ansi --no-root --without dev
COPY --from=builder /usr/src/app/use_case_voting ./use_case_voting
RUN poetry install --only-root
USER user
RUN touch $HOME/app/supervisord.pid
# Start nginx and FastAPI
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"] |