Skip to content

Commit

Permalink
Dockerfile now builds client
Browse files Browse the repository at this point in the history
  • Loading branch information
Donkie committed May 10, 2023
1 parent 0269518 commit 639a800
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
12 changes: 2 additions & 10 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,2 @@
.git
.github
.venv
.vscode
build
Dockerfile
tests

client
!client/dist
client/dist
client/node_modules
18 changes: 16 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
FROM python:3.11-alpine
FROM node:16-alpine as client-builder

COPY ./client /client
WORKDIR /client
RUN npm install
RUN npm run build

FROM python:3.11-alpine as runner

# Add local user so we don't run as root
RUN adduser -D app
Expand All @@ -7,10 +14,17 @@ USER app
ENV PATH="/home/app/.local/bin:${PATH}"

# Copy and install app
COPY --chown=app:app ./ /home/app/spoolman/
COPY --chown=app:app spoolman /home/app/spoolman/spoolman
COPY --chown=app:app pyproject.toml /home/app/spoolman/
COPY --chown=app:app requirements.txt /home/app/spoolman/
COPY --chown=app:app README.md /home/app/spoolman/

WORKDIR /home/app/spoolman
RUN pip install --user .

# Copy built client
COPY --chown=app:app --from=client-builder /client/dist /home/app/spoolman/client/dist

# Run command
EXPOSE 8000
CMD ["uvicorn", "spoolman.main:app", "--host", "0.0.0.0", "--port", "8000"]

0 comments on commit 639a800

Please sign in to comment.