46 lines
1.5 KiB
Docker
46 lines
1.5 KiB
Docker
FROM python:3.12-slim-bookworm
|
|
|
|
ENV TZ="Asia/Tokyo"
|
|
# pythonの標準出力をバッファリングしないフラグ
|
|
ENV PYTHONUNBUFFERED=1
|
|
# pythonのバイトコードを生成しないフラグ
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
|
|
WORKDIR /usr/src/app
|
|
COPY Pipfile Pipfile.lock ./
|
|
# mysql-apt-config をdpkgでインストールする際に標準出力に渡す文字列ファイルをコピー
|
|
COPY mysql_dpkg_selection.txt ./
|
|
# 必要なパッケージインストール
|
|
RUN apt update && apt install -y less vim curl wget gzip unzip sudo lsb-release
|
|
|
|
# mysqlをインストール
|
|
RUN \
|
|
wget https://dev.mysql.com/get/mysql-apt-config_0.8.29-1_all.deb && \
|
|
apt install -y gnupg && \
|
|
dpkg -i mysql-apt-config_0.8.29-1_all.deb < mysql_dpkg_selection.txt && \
|
|
apt update && \
|
|
apt install -y mysql-client
|
|
|
|
# aws cli v2 のインストール
|
|
RUN \
|
|
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
|
|
unzip awscliv2.zip && \
|
|
sudo ./aws/install
|
|
|
|
# python関連のライブラリインストール
|
|
RUN \
|
|
pip install --upgrade pip wheel setuptools && \
|
|
pip install pipenv --no-cache-dir && \
|
|
pipenv install --system --deploy && \
|
|
pip uninstall -y pipenv virtualenv-clone virtualenv
|
|
|
|
# パッケージのセキュリティアップデートのみを適用するコマンドを実行
|
|
RUN \
|
|
apt install -y unattended-upgrades && \
|
|
unattended-upgrades
|
|
|
|
COPY src ./src
|
|
COPY entrypoint.py entrypoint.py
|
|
|
|
CMD ["python", "entrypoint.py"]
|