generated from ibm-developer-skills-network/coding-project-template
-
Notifications
You must be signed in to change notification settings - Fork 127
Expand file tree
/
Copy pathDockerfile
More file actions
26 lines (20 loc) · 667 Bytes
/
Dockerfile
File metadata and controls
26 lines (20 loc) · 667 Bytes
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
FROM python:3.9-slim
# Added libraries for PostgreSQL before pip install
RUN apt-get update && apt-get install -y gcc libpq-dev
# Create working folder and install dependencies
WORKDIR /app
COPY requirements.txt .
RUN pip install -U pip wheel && \
pip install --no-cache-dir -r requirements.txt
# Copy the application contents
COPY service/ ./service/
# Switch to a non-root user
RUN useradd --uid 1000 vagrant && chown -R vagrant /app
USER vagrant
# Expose any ports the app is expecting in the environment
ENV FLASK_APP=service:app
ENV PORT 8080
EXPOSE $PORT
ENV GUNICORN_BIND 0.0.0.0:$PORT
ENTRYPOINT ["gunicorn"]
CMD ["--log-level=info", "service:app"]