-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (32 loc) · 872 Bytes
/
Copy pathDockerfile
File metadata and controls
45 lines (32 loc) · 872 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
FROM python:3.12-alpine AS test-image
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV FLASK_APP="blog"
ENV SQLALCHEMY_DATABASE_URI="sqlite:////app/tmp/dev.db"
WORKDIR /app
RUN apk update && apk add --no-cache make uv
COPY . .
RUN uv sync && make check && make test
FROM python:3.12-alpine
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV FLASK_APP="blog"
ENV SQLALCHEMY_DATABASE_URI="sqlite:////app/tmp/dev.db"
RUN apk update && apk add --no-cache uv
WORKDIR /app
ARG UID=10000
RUN adduser \
--disabled-password \
--gecos "" \
--home "/app" \
--shell "/sbin/nologin" \
--uid "${UID}" \
appuser
# Copy the source code into the container.
COPY . .
RUN uv sync --no-dev -n
# Expose the port that the application listens on.
EXPOSE 5000
ENV PATH=/app/venv/bin:$PATH
# Run the application.
ENTRYPOINT [ "./entrypoint.sh" ]