-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (42 loc) · 1.47 KB
/
Dockerfile
File metadata and controls
56 lines (42 loc) · 1.47 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
FROM python:3.13.7
ARG TARGETPLATFORM
ARG TARGETARCH
ARG TARGETVARIANT
RUN printf "I'm building for TARGETPLATFORM=${TARGETPLATFORM}" \
&& printf ", TARGETARCH=${TARGETARCH}" \
&& printf ", TARGETVARIANT=${TARGETVARIANT} \n" \
&& printf "With uname -s : " && uname -s \
&& printf "and uname -m : " && uname -m
# Update OS and install packages
RUN apt-get update --yes && \
apt-get dist-upgrade --yes && \
apt-get install --yes \
screen \
unzip \
vim \
zip
# Create an application user
RUN useradd app_user --create-home
ARG APP_DIR="/opt/flight_sql_proxy"
RUN mkdir --parents ${APP_DIR} && \
chown app_user:app_user ${APP_DIR}
USER app_user
WORKDIR ${APP_DIR}
# Setup a Python Virtual environment
ENV VIRTUAL_ENV=${APP_DIR}/.venv
RUN python3 -m venv ${VIRTUAL_ENV} && \
echo ". ${VIRTUAL_ENV}/bin/activate" >> ~/.bashrc
# Set the PATH so that the Python Virtual environment is referenced for subsequent RUN steps (hat tip: https://pythonspeed.com/articles/activate-virtualenv-dockerfile/)
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
# Upgrade pip, setuptools, and wheel
RUN pip install --upgrade setuptools pip wheel
# Install the Python package (from source)
RUN pwd
COPY --chown=app_user:app_user pyproject.toml README.md LICENSE .
COPY --chown=app_user:app_user src ./src
RUN pip install .
# Cleanup source code
RUN rm -rf pyproject.toml README.md ./src
# Open web-socket port
EXPOSE 8765
ENTRYPOINT ["flight-sql-websocket-proxy-server"]