first commit

This commit is contained in:
Dohyun Lim committed 2026-02-03 17:34:25 +09:00
commit ac3b5b3015
40 files changed
+5996

No files matched your search

+75
View File
@@ -0,0 +1,75 @@
FROM ubuntu:24.04
ENV TZ=Asia/Seoul
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
# ========================================
# 1. Base packages & timezone setup
# ========================================
RUN apt-get update && \
apt-get install -y --no-install-recommends apt-utils && \
apt-get install -yq tzdata && \
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \
apt-get install -y \
curl wget git tar gnupg2 lsb-release lz4 zstd vim \
build-essential zlib1g-dev libncurses5-dev libgdbm-dev \
libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev \
python3-dev libmysqlclient-dev pkg-config ca-certificates
# ========================================
# 2. Python 3.13 build & install
# ========================================
RUN cd /usr/src && \
wget https://www.python.org/ftp/python/3.13.11/Python-3.13.11.tar.xz && \
tar -xf Python-3.13.11.tar.xz && \
cd Python-3.13.11 && \
./configure --enable-optimizations && \
make altinstall && \
rm -rf /usr/src/Python-3.13.11 /usr/src/Python-3.13.11.tar.xz
# ========================================
# 3. Python symlinks
# ========================================
RUN rm -f /usr/bin/python /usr/bin/python3 && \
ln -s /usr/local/bin/python3.13 /usr/bin/python && \
ln -s /usr/local/bin/python3.13 /usr/bin/python3 && \
ln -s /usr/local/bin/python3.13 /usr/local/bin/python && \
ln -s /usr/local/bin/python3.13 /usr/local/bin/python3 && \
ln -s /usr/local/bin/pip3.13 /usr/bin/pip && \
ln -s /usr/local/bin/pip3.13 /usr/bin/pip3 && \
ln -s /usr/local/bin/pip3.13 /usr/local/bin/pip && \
ln -s /usr/local/bin/pip3.13 /usr/local/bin/pip3
# ========================================
# 4. Python packages
# ========================================
RUN pip install --upgrade pip && \
pip install wheel && \
pip install sqlalchemy alembic pydantic && \
pip install psycopg2-binary asyncpg && \
pip install mysqlclient asyncmy && \
pip install gunicorn uvicorn[standard] && \
pip install fastapi uv poetry
# ========================================
# 5. Percona XtraBackup (mysql backup)
# ========================================
RUN curl -O https://repo.percona.com/apt/percona-release_latest.generic_all.deb && \
apt-get install -y ./percona-release_latest.generic_all.deb && \
rm -f percona-release_latest.generic_all.deb && \
apt-get update && \
percona-release enable pxb-84-lts && \
apt-get install -y percona-xtrabackup-84
# ========================================
# 6. PostgreSQL backup (pgbackrest)
# ========================================
RUN apt-get install -y pgbackrest
# ========================================
# 7. Cleanup
# ========================================
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
update-ca-certificates
+45
View File
@@ -0,0 +1,45 @@
FROM nginx:1.26-bookworm
ENV TZ=Asia/Seoul
ENV DEBIAN_FRONTEND=noninteractive
# ========================================
# 1. Base packages & timezone setup
# ========================================
RUN apt-get update && \
apt-get install -y --no-install-recommends apt-utils && \
apt-get install -yq tzdata && \
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# ========================================
# 2. Required packages
# ========================================
RUN apt-get install -y sendmail wget gnupg ca-certificates
# ========================================
# 3. Cron & Certbot (SSL auto-renewal)
# ========================================
RUN apt-get install -y cron certbot python3-certbot-nginx
# ========================================
# 4. CA certificates
# ========================================
RUN update-ca-certificates && \
chmod 644 /etc/ssl/certs/ca-certificates.crt
# ========================================
# 5. Cleanup
# ========================================
RUN apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# ========================================
# 6. Certbot auto-renewal cron job
# ========================================
RUN crontab -l 2>/dev/null | { cat; echo "0 5 * * 1 certbot renew --quiet --deploy-hook \"nginx -t && service nginx reload\" >> /log/nginx/crontab_\$(date +\%Y\%m\%d).log 2>&1"; } | crontab -
# ========================================
# 7. Add cron to nginx entrypoint
# ========================================
RUN sed -i'' -r -e "/set/i\cron" /docker-entrypoint.sh || true