Skip to content

Commit

Permalink
build: improve dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
yxtay committed Jan 30, 2024
1 parent 6656f61 commit 1ecbf6e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
**/__pycache__/
**/*.py[cod]
**/*$py.class

# C extensions
*.so
Expand Down
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,33 @@ ARG UID=1000
RUN useradd --no-create-home --shell /bin/false --uid ${UID} ${USER}

# set up environment
ARG VIRTUAL_ENV=/opt/venv
ARG VIRTUAL_ENV=/work/venv
ENV PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
VIRTUAL_ENV=${VIRTUAL_ENV} \
PATH=${VIRTUAL_ENV}/bin:${PATH}

ARG APP_HOME=/opt/app
ARG APP_HOME=/work/app
WORKDIR ${APP_HOME}

##
# dev
##
FROM base AS dev

ARG DEBIAN_FRONTEND=noninteractive
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
rm -f /etc/apt/apt.conf.d/docker-clean && \
apt-get update && \
apt-get install --no-install-recommends -y \
build-essential \
curl \
curl \
&& rm -rf /var/lib/apt/lists/*

ENV PYTHONDONTWRITEBYTECODE=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_COMPILE=1 \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_CREATE=0
POETRY_NO_INTERACTION=1

# set up python
RUN --mount=type=cache,target=/root/.cache/pip \
Expand All @@ -59,7 +59,7 @@ RUN --mount=type=cache,target=/root/.cache/pypoetry \
EXPOSE 8000
ARG ENVIRONMENT=dev
ENV ENVIRONMENT ${ENVIRONMENT}
CMD ["gunicorn", "-c", "python:example_app.gunicorn_conf"]
CMD ["gunicorn", "-c", "python:example_app.gunicorn_conf", "--reload"]

##
# ci
Expand Down

0 comments on commit 1ecbf6e

Please sign in to comment.