Skip to content
Snippets Groups Projects
Commit 066648f0 authored by Konrad Mohrfeldt's avatar Konrad Mohrfeldt :fist:
Browse files

feat: add container image config

parent 9f42b57b
Branches
No related tags found
No related merge requests found
Pipeline #5621 failed
timeywimey-app/build
timeywimey-app/dist
timeywimey-app/node_modules
timeywimey/static/timeywimey/bundled/
include:
- project: 'kmohrf/gitlabfilet'
ref: 'v1.1.0'
file:
- '/templates/python.gitlab-ci.yml'
- '/templates/container.gitlab-ci.yml'
stages:
- test
- build
- deploy
FROM node:lts-alpine as assets
USER root
RUN apk add coreutils curl make wget
WORKDIR /home/node/app
ADD package.json package-lock.json ./
RUN npm ci
ADD Makefile eslint.config.js postcss.config.js tailwind.config.js vite.config.ts ./
ADD ./src/ ./src/
RUN make
FROM debian:bookworm
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV POETRY_VIRTUALENVS_OPTIONS_SYSTEM_SITE_PACKAGES=true
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
ENV LANG C.UTF-8
ENV PYTHONPATH=/usr/share/timeywimey
ENV DJANGO_SETTINGS_MODULE=timeywimey.settings
ENV TIMEYWIMEY_DATA_DIR=/var/lib/timeywimey
ENV TIMEYWIMEY_ASSET_SOURCE=manifest
RUN apt update -y && \
apt install -y --no-install-recommends \
adduser \
gettext \
locales \
netcat-openbsd \
python3 \
python3-poetry \
&& \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/*
ADD pyproject.toml poetry.lock /usr/share/timeywimey/
RUN poetry --directory /usr/share/timeywimey/ install --sync --without=dev --with=production --no-root
ADD timeywimey /usr/share/timeywimey/timeywimey/
COPY --from=assets /home/node/app/timeywimey/static/timeywimey/bundled/ /usr/share/timeywimey/timeywimey/static/timeywimey/bundled/
COPY docker/entrypoint.sh /usr/local/bin/timeywimeyctl
RUN printf 'de_DE.UTF-8 UTF-8\nen_US.UTF-8 UTF-8\n' >/etc/locale.gen && \
locale-gen && \
update-locale LANG=de_DE.UTF-8 LC_MESSAGES=en_US.UTF-8
RUN timeywimeyctl compilemessages --locale de >/dev/null
RUN adduser --system --group --firstuid 210 --firstgid 210 --home /var/lib/timeywimey _timeywimey && chown -R _timeywimey: /var/lib/timeywimey
USER _timeywimey
WORKDIR /var/lib/timeywimey
EXPOSE 8000
ENTRYPOINT ["/usr/local/bin/timeywimeyctl"]
CMD ["uvicorn", "0.0.0.0:8000"]
HEALTHCHECK --start-period=20s CMD nc -z localhost 8000
#!/bin/sh
set -eu
alias python='poetry --directory /usr/share/timeywimey/ run python3'
if [ "${1:-}" = "runserver" ] || [ "${1:-}" = "uvicorn" ]; then
python -m django migrate --no-input
python -m django collectstatic --no-input --clear
fi
if [ "${1:-}" = "uvicorn" ]; then
listen=${2:-0.0.0.0:8000}
host=$(echo "$listen" | cut -d: -f1)
port=$(echo "$listen" | cut -d: -f2)
python -m uvicorn timeywimey.asgi:application \
--host "$host" \
--port "$port" \
--reload-dir /usr/share/timeywimey/ \
--reload
else
python -m django "$@"
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment