-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (42 loc) · 1.51 KB
/
Dockerfile
File metadata and controls
56 lines (42 loc) · 1.51 KB
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
# syntax=docker/dockerfile:1
# Comments are provided throughout this file to help you get started.
# If you need more help, visit the Dockerfile reference guide at
# https://docs.docker.com/engine/reference/builder/
FROM python:3.11.7-alpine3.18 as base
RUN mkdir -p "/etc/config/others"
RUN mkdir -p "/etc/config/secrets"
# Prevents Python from writing pyc files.
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
POETRY_VERSION=1.6.1
RUN pip install "poetry==$POETRY_VERSION"
# TODO: parametrize - it should be dev only setup
# responsible for detecting changes on
RUN apk add --update nodejs npm
RUN npm install -g nodemon
WORKDIR /app
COPY poetry.lock pyproject.toml /app/
RUN poetry config virtualenvs.create false \
&& poetry install $(test "$YOUR_ENV" == production && echo "--no-dev") --no-interaction --no-ansi
# Create a non-privileged user that the app will run under.
# See https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#user
ARG UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
appuser
# Switch to the non-privileged user to run the application.
USER appuser
# Copy the source code into the container.
COPY . /app
WORKDIR /app
# Expose the port that the application listens on.
EXPOSE $PORT
# Run the application.
# TODO: parametrize - it should be dev only setup
# #TODO: ultimately it should be moved to k8s deployment "command" level
CMD nodemon main.py