Skip to content

Commit

Permalink
Merge pull request SelfhostedPro#702 from SelfhostedPro/wicked-testde…
Browse files Browse the repository at this point in the history
…ploy

Wicked testdeploy
  • Loading branch information
wickedyoda authored Aug 15, 2024
2 parents bd7959a + 2cf1a95 commit 0fea6fe
Show file tree
Hide file tree
Showing 3 changed files with 158 additions and 88 deletions.
100 changes: 52 additions & 48 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,60 +1,64 @@
# Build Vue
FROM node:14.5.0-alpine as build-stage
# Build Vue.js frontend
FROM node:20-alpine as build-stage

ARG VUE_APP_VERSION
ENV VUE_APP_VERSION=${VUE_APP_VERSION}

WORKDIR /app
COPY ./frontend/package*.json ./
RUN npm install
COPY ./frontend/ .
RUN npm run build
RUN npm install --verbose
COPY ./frontend/ ./
RUN npm run build --verbose

# Setup Container and install Flask
FROM lsiobase/alpine:3.12 as deploy-stage
# MAINTANER Your Name "info@selfhosted.pro"
# Setup Container and install Flask backend
FROM python:3.11-alpine as deploy-stage

# Set Variables
# Set environment variables
ENV PYTHONIOENCODING=UTF-8
ENV THEME=Default

WORKDIR /api
COPY ./backend/requirements.txt .

# Install Dependancies
RUN \
echo "**** install build packages ****" && \
apk add --no-cache --virtual=build-dependencies \
g++ \
make \
postgresql-dev \
python3-dev \
libffi-dev \
ruby-dev &&\
echo "**** install packages ****" && \
apk add --no-cache \
python3 \
py3-pip \
mysql-dev \
postgresql-dev \
mysql-dev \
nginx &&\
gem install sass &&\
echo "**** Installing Python Modules ****" && \
pip3 install wheel &&\
pip3 install -r requirements.txt &&\
# Delay cleaning up until all tasks are done
RUN apk del --purge build-dependencies && \
rm -rf /root/.cache /tmp/*

COPY ./backend/api ./
COPY ./backend/alembic /alembic
COPY root ./backend/alembic.ini /

# Vue
COPY --from=build-stage /app/dist /app
COPY nginx.conf /etc/nginx/

# Expose
VOLUME /config
EXPOSE 8000
COPY ./backend/requirements.txt ./

# Install build dependencies and system libraries
RUN apk add --no-cache \
build-base \
gcc \
g++ \
make \
libffi-dev \
openssl-dev \
musl-dev \
postgresql-dev \
mysql-dev \
jpeg-dev \
zlib-dev \
yaml-dev \
python3-dev \
ruby-dev \
nginx \
curl

# Install Docker Compose 2.x as a standalone binary
RUN curl -L "https://github.com/docker/compose/releases/download/v2.20.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && \
chmod +x /usr/local/bin/docker-compose

# Upgrade pip, setuptools, and wheel
RUN pip3 install --upgrade pip setuptools wheel

# Install Python packages from requirements.txt
RUN pip3 install -r requirements.txt --no-cache-dir --verbose

# Install SASS via gem
RUN gem install sass --verbose

# Clean up build dependencies
RUN apk del --purge build-base && \
rm -rf /root/.cache /tmp/*

# Copy the backend code
COPY ./backend/ ./

# Expose ports and define the command to run the application
EXPOSE 5000
CMD ["python3", "app.py"]
86 changes: 46 additions & 40 deletions backend/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,44 +1,50 @@
aiodocker==0.19.1
aiosqlite==0.15.0
aiostream==0.4.3
alembic==1.4.3
bcrypt==3.1.7
aiodocker==0.21.0
aiosqlite==0.19.0
aiostream==0.4.4
alembic==1.10.4
bcrypt==4.0.1
certifi==2023.7.22
cffi==1.14.1
chardet==3.0.4
click==7.1.2
databases==0.3.2
dnspython==2.0.0
docker==4.4.4
docker-compose==1.28.4
email-validator==1.1.1
fastapi==0.63.0
cffi==1.15.1
chardet==4.0.0
click==8.1.6
databases==0.6.2
dnspython==2.3.0
docker==6.1.2
# docker-compose==2.20.0 (wrong version cant deploy)
email-validator==1.3.1
fastapi==0.103.1
# fastapi-jwt-auth==0.6.1 (wrong version cant deploy)
fastapi-jwt-auth==0.5.0
gunicorn==20.0.4
h11==0.9.0
httptools==0.1.1
idna==2.10
python-jose==3.2.0
makefun==1.9.2
mysqlclient==2.0.3
gunicorn==20.1.0
h11==0.14.0
httptools==0.5.0
idna==3.4
python-jose==3.3.0
makefun==1.15.0
mysqlclient==2.2.0
passlib==1.7.4
psycopg2-binary==2.8.6
pycparser==2.20
pydantic==1.7.3
# passlib==1.8.1 (wrong version cant deploy)
psycopg2-binary==2.9.7
pycparser==2.21
pydantic==2.0.2
# PyJWT==2.7.0
PyJWT==1.7.1
python-multipart==0.0.5
PyYAML==5.4
requests==2.24.0
six==1.15.0
sh==1.14.1
SQLAlchemy==1.3.19
starlette==0.13.6
sse-starlette==0.6.2
typing-extensions==3.7.4.2
urllib3==1.26.18
uvicorn==0.11.8
uvloop==0.14.0
websocket-client==0.57.0
websockets==8.1
wheel==0.38.0
setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability
python-multipart==0.0.6
PyYAML==6.0.1
requests==2.31.0
six==1.16.0
sh==1.14.3
# SQLAlchemy==2.0.20
SQLAlchemy==1.4.41
starlette==0.27.0
# sse-starlette==1.4.1 (wrong version cant deploy)
sse-starlette==2.1.3
typing-extensions==4.7.1
urllib3==2.0.4
uvicorn==0.22.0
uvloop==0.17.0
# websocket-client==1.7.2 (wrong version cant deploy)
websocket-client==1.6.4
websockets==11.0.2
wheel==0.41.0
setuptools==68.0.0
60 changes: 60 additions & 0 deletions backup-files/backup- Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Build Vue
FROM node:14.5.0-alpine as build-stage

ARG VUE_APP_VERSION
ENV VUE_APP_VERSION=${VUE_APP_VERSION}

WORKDIR /app
COPY ./frontend/package*.json ./
RUN npm install
COPY ./frontend/ .
RUN npm run build

# Setup Container and install Flask
FROM lsiobase/alpine:3.12 as deploy-stage
# MAINTANER Your Name "info@selfhosted.pro"

# Set Variables
ENV PYTHONIOENCODING=UTF-8
ENV THEME=Default

WORKDIR /api
COPY ./backend/requirements.txt .

# Install Dependancies
RUN \
echo "**** install build packages ****" && \
apk add --no-cache --virtual=build-dependencies \
g++ \
make \
postgresql-dev \
python3-dev \
libffi-dev \
ruby-dev &&\
echo "**** install packages ****" && \
apk add --no-cache \
python3 \
py3-pip \
mysql-dev \
postgresql-dev \
mysql-dev \
nginx &&\
gem install sass &&\
echo "**** Installing Python Modules ****" && \
pip3 install wheel &&\
pip3 install -r requirements.txt &&\
# Delay cleaning up until all tasks are done
RUN apk del --purge build-dependencies && \
rm -rf /root/.cache /tmp/*

COPY ./backend/api ./
COPY ./backend/alembic /alembic
COPY root ./backend/alembic.ini /

# Vue
COPY --from=build-stage /app/dist /app
COPY nginx.conf /etc/nginx/

# Expose
VOLUME /config
EXPOSE 8000

0 comments on commit 0fea6fe

Please sign in to comment.