generated from hack4impact/flask-base
-
-
Notifications
You must be signed in to change notification settings - Fork 171
/
Dockerfile
64 lines (51 loc) · 1.46 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# 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 --verbose
COPY ./frontend/ ./
RUN npm run build --verbose
# Setup Container and install Flask backend
FROM python:3.11-alpine as deploy-stage
# Set environment variables
ENV PYTHONIOENCODING=UTF-8
ENV THEME=Default
WORKDIR /api
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"]