Initial commit
This commit is contained in:
commit
6a110c2bbd
4 changed files with 63 additions and 0 deletions
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
/munch-ease-backend
|
||||
/munch-ease-frontend
|
||||
/munch-ease-backend-buildartifact
|
||||
/munch-ease-frontend-buildartifact
|
||||
20
Dockerfile
Normal file
20
Dockerfile
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
FROM python:3.11
|
||||
|
||||
ARG FRONTEND_DIR=munch-ease-frontend
|
||||
ARG BACKEND_DIR=munch-ease-backend
|
||||
|
||||
WORKDIR /code
|
||||
|
||||
COPY ${BACKEND_DIR}/requirements.txt /code/requirements.txt
|
||||
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
||||
|
||||
COPY ${BACKEND_DIR} /code/app
|
||||
COPY ${FRONTEND_DIR}/dist /code/app/front-dist
|
||||
|
||||
# Set production flag
|
||||
ENV DOOF_PROD=1
|
||||
|
||||
EXPOSE 80
|
||||
WORKDIR /code/app
|
||||
|
||||
CMD python -m uvicorn main:app --host 0.0.0.0 --port 80
|
||||
5
build-local.sh
Executable file
5
build-local.sh
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
(cd ./front && npm install && npm run build)
|
||||
|
||||
docker build -t doof .
|
||||
34
build-remote.sh
Executable file
34
build-remote.sh
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Stop on error
|
||||
set -e
|
||||
|
||||
# Clone the munch-ease-frontend & munch-ease-backend repos
|
||||
# from https://git.jacobsthings.dynu.net/jacob/munch-ease-frontend.git
|
||||
# and https://git.jacobsthings.dynu.net/jacob/munch-ease-backend.git
|
||||
# respectively
|
||||
|
||||
if [ -d ./munch-ease-frontend-buildartifact ]; then
|
||||
rm -rf ./munch-ease-frontend-buildartifact
|
||||
fi
|
||||
|
||||
if [ -d ./munch-ease-backend-buildartifact ]; then
|
||||
rm -rf ./munch-ease-backend-buildartifact
|
||||
fi
|
||||
|
||||
git clone https://git.jacobsthings.dynu.net/jacob/munch-ease-frontend.git ./munch-ease-frontend-buildartifact
|
||||
git clone https://git.jacobsthings.dynu.net/jacob/munch-ease-backend.git ./munch-ease-backend-buildartifact
|
||||
|
||||
# Build the frontend via docker node:16
|
||||
docker run -v "$(pwd)/munch-ease-frontend-buildartifact:/tmp/munch-ease/frontend" node:16 /bin/bash -c "cd /tmp/munch-ease/frontend && npm install && npm run build"
|
||||
|
||||
# Build the container, setting the FRONTEND_DIR and BACKEND_DIR args
|
||||
docker build -t doof --build-arg FRONTEND_DIR=./munch-ease-frontend-buildartifact --build-arg BACKEND_DIR=./munch-ease-backend-buildartifact .
|
||||
|
||||
if [ -d ./munch-ease-frontend-buildartifact ]; then
|
||||
rm -rf ./munch-ease-frontend-buildartifact
|
||||
fi
|
||||
|
||||
if [ -d ./munch-ease-backend-buildartifact ]; then
|
||||
rm -rf ./munch-ease-backend-buildartifact
|
||||
fi
|
||||
Loading…
Reference in a new issue