build(Dockerfile): SHOULD be done with Dockerfile, hopefully it builds
This commit is contained in:
parent
bd53772e21
commit
12fd55f172
6 changed files with 38 additions and 46 deletions
8
.dockerignore
Normal file
8
.dockerignore
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# For development purposes only
|
||||
**/node_modules
|
||||
.env
|
||||
**/dist
|
||||
**/venv
|
||||
*.log
|
||||
**/__pycache__
|
||||
docker-compose-dev.yml
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -2,3 +2,4 @@
|
|||
venv
|
||||
__pycache__
|
||||
node_modules
|
||||
docker-compose-dev.yml
|
||||
|
|
|
|||
39
Dockerfile
39
Dockerfile
|
|
@ -2,33 +2,38 @@
|
|||
# the application
|
||||
FROM node:25-alpine
|
||||
|
||||
# WARNING: These ports are the default ports for the app, you should probably
|
||||
# change them eventually, OR use docker-compose.yml to change them.
|
||||
EXPOSE 8000
|
||||
EXPOSE 3000
|
||||
WORKDIR /app
|
||||
|
||||
RUN <<EOF
|
||||
apk update
|
||||
apk add python3
|
||||
apk add bash
|
||||
apk add --no-cache python3 bash py3-pip
|
||||
EOF
|
||||
|
||||
|
||||
# NOTE: Filesystem setup (probably needs COPY and WORKDIR)
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
# NOTE: Frontend setup
|
||||
COPY frontend/package.json frontend/package-lock.json ./frontend/
|
||||
WORKDIR /app/frontend
|
||||
RUN npm i
|
||||
RUN npm run build
|
||||
RUN npm ci && npx next telemetry disable
|
||||
|
||||
# NOTE: Backend setup
|
||||
WORKDIR /app/api
|
||||
RUN <<EOF
|
||||
bash ./run.bash
|
||||
EOF
|
||||
COPY api/requirements.txt ./
|
||||
RUN python3 -m venv venv
|
||||
ENV PATH="/app/api/venv/bin:$PATH"
|
||||
RUN <<EOF
|
||||
pip install --no-cache-dir -U -r requirements.txt
|
||||
pip install -U pip
|
||||
EOF
|
||||
|
||||
# NOTE: Copy rest of the source code
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
|
||||
WORKDIR /app/frontend
|
||||
RUN npm run build
|
||||
|
||||
EXPOSE 8000
|
||||
EXPOSE 3000
|
||||
|
||||
WORKDIR /app
|
||||
RUN "bash /app/run.bash"
|
||||
ENTRYPOINT ["bash", "/app/start.bash"]
|
||||
|
|
|
|||
19
api/run.bash
19
api/run.bash
|
|
@ -1,19 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
#if [ ! -f .env ]; then
|
||||
# env | grep DESEC_TOKEN >>.env
|
||||
# env | grep CURRENT_DOMAIN >>.env
|
||||
#fi
|
||||
|
||||
# If virtual environment does exist..
|
||||
if [ ! -d venv ]; then
|
||||
python3 -m venv venv
|
||||
source venv/bin/activate
|
||||
pip install -U -r requirements.txt
|
||||
pip install -U pip
|
||||
fi
|
||||
|
||||
# Assuming that your environemnt is already setup
|
||||
if [ -d venv ]; then
|
||||
pip install -U -r requirements.txt
|
||||
fi
|
||||
11
run.bash
11
run.bash
|
|
@ -1,11 +0,0 @@
|
|||
#!/bin/bash
|
||||
source ./api/venv/bin/activate
|
||||
|
||||
cd ./frontend/ || exit
|
||||
|
||||
# NOTE: Hopefully this runs these two in the background.
|
||||
npm run start &
|
||||
(
|
||||
cd ../api/src || exit
|
||||
fastapi run
|
||||
) &
|
||||
8
start.bash
Executable file
8
start.bash
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
echo "$@"
|
||||
|
||||
if [[ $1 == "web" ]]; then
|
||||
cd ./frontend/ && npm run start
|
||||
elif [[ $1 == "api" ]]; then
|
||||
cd ./api/ && source venv/bin/activate && cd ./src && fastapi run
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue