-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
35 lines (24 loc) · 911 Bytes
/
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
# syntax=docker/dockerfile:1
FROM python:3.11-slim-bullseye
LABEL authors="andrii_malchyk"
# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1
# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1
# Create app directory
WORKDIR /geoapi
# Install app dependencies
COPY ./requirements.txt /geoapi/requirements.txt
RUN pip install --upgrade pip && pip install -r requirements.txt
# Bundle app source
COPY ./geoapi/ /geoapi/
ARG DB_CONNECTION_STRING
ARG DB_SCHEMA_NAME
ARG DB_TABLE_NAME
ENV DB_CONNECTION_STRING=${DB_CONNECTION_STRING}
ENV DB_SCHEMA_NAME=${DB_SCHEMA_NAME}
ENV DB_TABLE_NAME=${DB_TABLE_NAME}
# Creates a non-root user and adds permission to access the /geoapi folder
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /geoapi
USER appuser
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "80"]