-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
52 lines (41 loc) · 2.13 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
FROM python:3.9.17-slim
WORKDIR /app
ARG ENV_TYPE
ARG UID
ARG NODE_VERSION=16.20.0
ARG NODE_PACKAGE=node-v$NODE_VERSION-linux-x64
ARG NODE_HOME=/opt/$NODE_PACKAGE
ENV NODE_PATH="$NODE_HOME/lib/node_modules" \
POETRY_HOME="/opt/poetry"
ENV PATH="$NODE_HOME/bin:$POETRY_HOME/bin:$PATH"
RUN apt-get update --fix-missing -y && apt-get upgrade -y \
&& apt-get install curl gnupg -y \
&& apt-get install -y gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils \
&& curl -fsSL https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | tee /etc/apt/sources.list.d/google-chrome.list \
&& apt-get update -y \
&& apt-get install google-chrome-stable -y \
# install Node and Poetry
&& curl https://nodejs.org/dist/v$NODE_VERSION/$NODE_PACKAGE.tar.gz | tar -xzC /opt/ \
&& curl -sSL https://install.python-poetry.org | python3 -
COPY package.json package-lock.jso[n] ./
COPY pyproject.toml poetry.loc[k] ./
# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1 \
# enable installing dependencies into the system's python environment
# POETRY_VIRTUALENVS_CREATE=false
POETRY_VIRTUALENVS_PATH=/.globals/poetry
RUN if [ "$ENV_TYPE" = "dev" ]; then \
apt-get update -y && apt-get upgrade -y && apt-get install git -y \
;fi
RUN adduser -u ${UID} --disabled-password --gecos "" appuser && chown -R appuser /app \
&& mkdir -p $POETRY_VIRTUALENVS_PATH && chown -R appuser $POETRY_VIRTUALENVS_PATH
USER appuser
# install dependencies
RUN if [ "$ENV_TYPE" = "dev" ]; then \
poetry install --no-root \
&& npm i \
;elif [ "$ENV_TYPE" = "prod" ]; then \
poetry install --without dev --no-root \
&& npm ci \
;fi