-
Notifications
You must be signed in to change notification settings - Fork 25
/
Dockerfile
55 lines (45 loc) · 1.49 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
51
52
53
54
55
# ARGUMENTS --------------------------------------------------------------------
##
# Board architecture
##
ARG IMAGE_ARCH=
##
# Base container version
##
ARG BASE_VERSION=3.3.1-bookworm
##
# Directory of the application inside container
##
ARG APP_ROOT=
FROM --platform=linux/${IMAGE_ARCH} \
commontorizon/debian:${BASE_VERSION} AS deploy
ARG IMAGE_ARCH
ARG APP_ROOT
# your regular RUN statements here
# Install required packages
RUN apt-get -q -y update && \
apt-get -q -y install \
python3-minimal \
python3-pip \
python3-venv \
# DO NOT REMOVE THIS LABEL: this is used for VS Code automation
# __torizon_packages_prod_start__
# __torizon_packages_prod_end__
# DO NOT REMOVE THIS LABEL: this is used for VS Code automation
&& apt-get clean && apt-get autoremove && \
rm -rf /var/lib/apt/lists/*
# Create virtualenv
RUN python3 -m venv ${APP_ROOT}/.venv --system-site-packages
# Install pip packages on venv
COPY requirements-release.txt /requirements-release.txt
RUN . ${APP_ROOT}/.venv/bin/activate && \
pip3 install --upgrade pip && pip3 install -r requirements-release.txt && \
rm requirements-release.txt
# Copy the application source code in the workspace to the $APP_ROOT directory
# path inside the container, where $APP_ROOT is the torizon_app_root
# configuration defined in settings.json
COPY ./src ${APP_ROOT}/src
WORKDIR ${APP_ROOT}
ENV APP_ROOT=${APP_ROOT}
# Activate and run the code
CMD . ${APP_ROOT}/.venv/bin/activate && python3 src/main.py --no-sandbox