Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +27 -33
Dockerfile
CHANGED
@@ -1,42 +1,36 @@
|
|
|
|
1 |
FROM python:3.9-slim
|
2 |
|
3 |
-
|
4 |
WORKDIR /app
|
5 |
|
6 |
-
|
7 |
-
COPY
|
8 |
-
|
9 |
-
# Install build dependencies
|
10 |
-
RUN apt-get update \
|
11 |
-
&& apt-get install -y --no-install-recommends build-essential \
|
12 |
-
&& pip install --upgrade pip poetry \
|
13 |
-
&& poetry config virtualenvs.create false \
|
14 |
-
&& poetry install --no-interaction --no-ansi
|
15 |
-
|
16 |
-
# Install runtime dependencies
|
17 |
-
RUN apt-get update \
|
18 |
-
&& apt-get install -y --no-install-recommends redis-server postgresql \
|
19 |
-
&& apt-get clean \
|
20 |
-
&& rm -rf /var/lib/apt/lists/*
|
21 |
-
|
22 |
-
# Start Redis and Postgres
|
23 |
-
RUN service redis-server start
|
24 |
-
RUN service postgresql start
|
25 |
-
|
26 |
-
# Create user, database, and grant privileges
|
27 |
-
#RUN su postgres -c "psql -c \"CREATE USER postadmin WITH PASSWORD 'postpass';\""
|
28 |
-
#RUN su postgres -c "psql -c \"CREATE DATABASE siksalaya;\""
|
29 |
-
#RUN su postgres -c "psql -c \"GRANT ALL PRIVILEGES ON DATABASE siksalaya TO postadmin;\""
|
30 |
|
31 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
ENV DATABASE_URL=postgresql://postadmin:postpass@localhost/siksalaya
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
RUN alembic revision --autogenerate -m "migrations"
|
37 |
|
38 |
-
#
|
39 |
-
|
|
|
40 |
|
41 |
-
# Start
|
42 |
-
CMD ["
|
|
|
1 |
+
# Use an official Python runtime as a parent image
|
2 |
FROM python:3.9-slim
|
3 |
|
4 |
+
# Set the working directory in the container
|
5 |
WORKDIR /app
|
6 |
|
7 |
+
# Copy the current directory contents into the container
|
8 |
+
COPY . /app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
+
# Install any needed packages specified in requirements.txt
|
11 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
12 |
+
build-essential \
|
13 |
+
supervisor \
|
14 |
+
postgresql \
|
15 |
+
redis-server && \
|
16 |
+
pip install --upgrade pip poetry && \
|
17 |
+
poetry config virtualenvs.create false && \
|
18 |
+
poetry install --no-interaction --no-ansi && \
|
19 |
+
apt-get clean && \
|
20 |
+
rm -rf /var/lib/apt/lists/*
|
21 |
+
|
22 |
+
# Copy supervisor configuration
|
23 |
+
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
24 |
+
|
25 |
+
# Set environment variable
|
26 |
ENV DATABASE_URL=postgresql://postadmin:postpass@localhost/siksalaya
|
27 |
|
28 |
+
# Make port 80 available to the world outside this container
|
29 |
+
EXPOSE 80
|
|
|
30 |
|
31 |
+
# Add and give execution permissions to the startup script
|
32 |
+
COPY start.sh start.sh
|
33 |
+
RUN chmod +x start.sh
|
34 |
|
35 |
+
# Start services
|
36 |
+
CMD ["/app/start.sh"]
|