Skip to content

Commit

Permalink
use alpine to lower the image size
Browse files Browse the repository at this point in the history
  • Loading branch information
tobru committed Sep 10, 2024
1 parent 5fd10bf commit af9faea
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Dockerfile.contactform
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### BUILDER
FROM python:3.12-bookworm as builder
FROM python:3.12-alpine as builder

Check warning on line 2 in Dockerfile.contactform

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

RUN pip install poetry==1.8.3

Expand All @@ -16,13 +16,14 @@ RUN touch README.md
RUN --mount=type=cache,target=$POETRY_CACHE_DIR poetry install --no-root

### RUNTIME
FROM python:3.12-bookworm as runtime
FROM python:3.12-alpine as runtime

Check warning on line 19 in Dockerfile.contactform

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

WORKDIR /app

RUN apt-get update && \
apt-get install -y nginx chromium dbus && \
rm -rf /var/lib/apt/lists/*
RUN apk upgrade --no-cache --available \
&& apk add --no-cache \
chromium-swiftshader \
nginx

ENV VIRTUAL_ENV=/app/.venv \
PATH="/app/.venv/bin:$PATH" \
Expand All @@ -35,9 +36,8 @@ COPY contactform ./contactform
COPY nginx.conf /etc/nginx/nginx.conf

RUN set -x && \
useradd -ms /bin/bash contactform && \
adduser -D contactform && \
mkdir -p /opt/data && \
ls -Alh /opt/data && \
chown -R contactform:root /app /opt/data /var/log/nginx /var/lib/nginx && \
chmod -R g=u /app /opt/data /var/log/nginx /var/lib/nginx

Expand Down

0 comments on commit af9faea

Please sign in to comment.