Skip to content

Commit

Permalink
fix docker builds (#2393)
Browse files Browse the repository at this point in the history
Co-authored-by: Vignesh Hari <14056798+vigneshhari@users.noreply.github.com>
  • Loading branch information
sainak and vigneshhari authored Aug 24, 2024
1 parent 20e659c commit 25afb1f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docker/dev.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ RUN ARCH=$(dpkg --print-architecture) && \
echo "Unsupported architecture: $ARCH"; \
exit 1; \
fi && \
wget -O typst.tar.xz https://github.com/typst/typst/releases/download/v${TYPST_VERSION}/typst-${TYPST_ARCH}.tar.xz && \
wget -qO typst.tar.xz https://github.com/typst/typst/releases/download/v${TYPST_VERSION}/typst-${TYPST_ARCH}.tar.xz && \
tar -xf typst.tar.xz && \
mv typst-${TYPST_ARCH}/typst /usr/local/bin/typst && \
chmod +x /usr/local/bin/typst && \
Expand Down
17 changes: 9 additions & 8 deletions docker/prod.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
ARG PYTHON_VERSION=3.11-slim-bullseye

FROM python:${PYTHON_VERSION} as base
FROM python:${PYTHON_VERSION} AS base

ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1


# ---
FROM base as builder
FROM base AS builder

ARG BUILD_ENVIRONMENT=production
ARG TYPST_VERSION=0.11.0

ENV PATH /venv/bin:$PATH

RUN apt-get update && apt-get install --no-install-recommends -y \
build-essential libjpeg-dev zlib1g-dev libpq-dev git
build-essential libjpeg-dev zlib1g-dev libpq-dev git wget \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*

# Download and install Typst for the correct architecture
RUN ARCH=$(dpkg --print-architecture) && \
Expand All @@ -27,11 +29,10 @@ RUN ARCH=$(dpkg --print-architecture) && \
echo "Unsupported architecture: $ARCH"; \
exit 1; \
fi && \
wget -O typst.tar.xz https://github.com/typst/typst/releases/download/v${TYPST_VERSION}/typst-${TYPST_ARCH}.tar.xz && \
wget -qO typst.tar.xz https://github.com/typst/typst/releases/download/v${TYPST_VERSION}/typst-${TYPST_ARCH}.tar.xz && \
tar -xf typst.tar.xz && \
mv typst-${TYPST_ARCH}/typst /usr/local/bin/typst && \
chmod +x /usr/local/bin/typst && \
rm -rf typst.tar.xz typst-${TYPST_ARCH} \
rm -rf typst.tar.xz typst-${TYPST_ARCH}

# use pipenv to manage virtualenv
RUN python -m venv /venv
Expand All @@ -47,7 +48,7 @@ RUN python3 /app/install_plugins.py


# ---
FROM base as runtime
FROM base AS runtime

ARG BUILD_ENVIRONMENT=production
ARG APP_HOME=/app
Expand All @@ -68,7 +69,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
&& rm -rf /var/lib/apt/lists/*

# copy typst binary from builder stage
COPY --from=builder /usr/local/bin/typst /usr/local/bin/typst
COPY --from=builder --chmod=0755 /usr/local/bin/typst /usr/local/bin/typst

# copy in Python environment
COPY --from=builder /venv /venv
Expand Down

0 comments on commit 25afb1f

Please sign in to comment.