forked from SamR1/FitTrackee
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
50 lines (39 loc) · 1.39 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
FROM python:3.13-alpine AS BUILDER
# install dependencies
RUN apk add --no-cache linux-headers gcc musl-dev libffi-dev \
--virtual=build-dependencies
RUN apk add --no-cache py-pip bash curl
# copy source files
RUN LATEST=$(curl -s \
"https://api.github.com/repos/SamR1/FitTrackee/releases/latest" | \
grep -i zipball_url | grep -Eo "https://.*[0-9]{1}") && \
wget "${LATEST}" -O /usr/src/latest.zip
RUN cd /usr/src/ && unzip latest.zip -d /usr/src/app
RUN sync
RUN mv /usr/src/app/*FitTrackee*/* /usr/src/app/
RUN rm -r /usr/src/app/*FitTrackee*/
RUN rm -r /usr/src/latest.zip
# install requirements
WORKDIR /usr/src/app
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir poetry
RUN . $VIRTUAL_ENV/bin/activate && poetry install --no-interaction
FROM python:3.13-alpine
RUN apk add bash
# create user fittrackee
RUN addgroup -g 1000 -S fittrackee
RUN adduser -u 1000 -S -D -G fittrackee -H -h /usr/src/app -s /bin/bash fittrackee
COPY --from=BUILDER /opt/venv/ /opt/venv
COPY --from=BUILDER /usr/src/app /usr/src/app
WORKDIR /usr/src/app
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# change owner
RUN chown -R fittrackee:fittrackee /usr/src/app
# run fittrackee server
USER fittrackee
CMD flask run --with-threads -h 0.0.0.0