Added frontend build to Docker image
continuous-integration/drone the build was successful
Details
continuous-integration/drone the build was successful
Details
parent
d557d45862
commit
f5b443d271
|
@ -1,7 +1,18 @@
|
||||||
# Ignore everything
|
# Ignore everything
|
||||||
*
|
*
|
||||||
|
|
||||||
# The stuff necessary to build the image
|
!Makefile
|
||||||
|
|
||||||
|
# Backend stuff
|
||||||
!app/
|
!app/
|
||||||
!setup.cfg
|
!setup.cfg
|
||||||
!setup.py
|
!setup.py
|
||||||
|
|
||||||
|
# Frontend stuff
|
||||||
|
!web/index.html
|
||||||
|
!web/src/
|
||||||
|
!web/package.json
|
||||||
|
!web/yarn.lock
|
||||||
|
!web/tsconfig.json
|
||||||
|
!web/public/
|
||||||
|
!web/vite.config.ts
|
||||||
|
|
19
Dockerfile
19
Dockerfile
|
@ -1,3 +1,4 @@
|
||||||
|
# Build backend wheels
|
||||||
FROM python:3.9 AS builder
|
FROM python:3.9 AS builder
|
||||||
|
|
||||||
WORKDIR /wheels
|
WORKDIR /wheels
|
||||||
|
@ -7,6 +8,18 @@ COPY ./setup.cfg ./
|
||||||
RUN pip wheel -e .
|
RUN pip wheel -e .
|
||||||
|
|
||||||
|
|
||||||
|
# Build frontend
|
||||||
|
FROM node:16 AS fbuilder
|
||||||
|
|
||||||
|
# Copy source code
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
COPY ./web ./web
|
||||||
|
COPY Makefile .
|
||||||
|
|
||||||
|
# Build frontend
|
||||||
|
RUN make fbuild
|
||||||
|
|
||||||
|
|
||||||
FROM python:3.9-slim
|
FROM python:3.9-slim
|
||||||
|
|
||||||
# Switch to non-root user
|
# Switch to non-root user
|
||||||
|
@ -30,5 +43,11 @@ WORKDIR /usr/src/app
|
||||||
COPY --chown=runner:runner ./app ./app
|
COPY --chown=runner:runner ./app ./app
|
||||||
COPY --chown=runner:runner setup.cfg setup.py ./
|
COPY --chown=runner:runner setup.cfg setup.py ./
|
||||||
|
|
||||||
|
# Copy frontend build
|
||||||
|
COPY \
|
||||||
|
--from=fbuilder \
|
||||||
|
--chown=runner:runner \
|
||||||
|
/usr/src/app/web/dist ./dist
|
||||||
|
|
||||||
ENTRYPOINT ["python"]
|
ENTRYPOINT ["python"]
|
||||||
CMD ["app"]
|
CMD ["app"]
|
||||||
|
|
7
Makefile
7
Makefile
|
@ -87,3 +87,10 @@ ftest: node_modules
|
||||||
fbuild: node_modules
|
fbuild: node_modules
|
||||||
@ yarn --cwd '$(WEB_DIR)' build
|
@ yarn --cwd '$(WEB_DIR)' build
|
||||||
.PHONY: fbuild
|
.PHONY: fbuild
|
||||||
|
|
||||||
|
|
||||||
|
# =====DOCKER=====
|
||||||
|
## Build image
|
||||||
|
dbuild:
|
||||||
|
@ DOCKER_BUILDKIT=1 docker build -t chewingbever/jos:dev .
|
||||||
|
.PHONY: image
|
||||||
|
|
Reference in New Issue