Open UHSL-Marcus opened 2 years ago
Hi! The folder should be created when compiling the css files, so it's ok that it's not in the checkout. But it's strange that you get the error, looking at the logs in the github actions that build the images everything looks fine. What commands did you use?
Thanks for replying.
I have had to "adjust" the Dockerfiles slightly, I merged base in with the main file & I needed to add some extra apt installs to get the container to run. Python would complain about being unable to find certain .so files.
My Dockerfile is as below:
#
# Docker image for wger development
#
# Please consult the README for usage
#
# Note: you MUST build this image from the project's root!
# docker build -f extras/docker/development/Dockerfile --tag wger/server .
#
# Run the container:
# docker run -ti -v /path/to/this/checkout:/home/wger/src --name wger.dev --publish 8000:8000 wger/server
##########
# Base
##########
FROM ubuntu:22.04 as base
LABEL maintainer="Roland Geider <roland@geider.net>"
# Install dependencies
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
git \
locales \
nodejs \
npm \
libfreetype6-dev \
libpq-dev \
libjpeg-dev \
libxslt-dev \
python3-venv \
python3-pip \
sqlite3 \
&& rm -rf /var/lib/apt/lists/* \
&& npm install -g yarn sass\
&& locale-gen en_US.UTF-8
# Environmental variables
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Add wger user
RUN adduser wger --disabled-password --gecos ""
##########
# Builder
##########
FROM ubuntu:22.04 as builder
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
build-essential \
libfreetype6-dev \
libpq-dev \
libxml2-dev \
libxslt-dev \
libjpeg-dev \
zlib1g-dev \
python3-dev \
python3-pip \
python3-wheel \
git
# Build the necessary python wheels
COPY requirements* ./
RUN pip3 wheel --no-cache-dir --wheel-dir /wheels -r requirements_prod.txt
########
# Final
########
FROM base
LABEL maintainer="Roland Geider <roland@geider.net>"
ARG DOCKER_DIR=./extras/docker/development
ENV PATH="/home/wger/.local/bin:$PATH"
EXPOSE 8000
# Set up the application
WORKDIR /home/wger/src
COPY --chown=wger:wger . /home/wger/src
COPY --from=builder /wheels /wheels
COPY ${DOCKER_DIR}/settings.py /home/wger/src
COPY ${DOCKER_DIR}/settings.py /tmp/
COPY ${DOCKER_DIR}/entrypoint.sh /home/wger/entrypoint.sh
RUN chmod +x /home/wger/entrypoint.sh
RUN pip3 install --no-cache /wheels/*
RUN chown -R wger:wger .
USER wger
RUN mkdir ~/media \
&& pip3 install -e . \
&& mkdir ~/static \
&& mkdir ~/db/
CMD ["/home/wger/entrypoint.sh"]
I had to add a few packages to both builder and base to get it to build and run respectively.
I have also got an adjusted compose yaml:
services:
nginx-proxy:
build: proxy
ports:
- 60465:80
depends_on:
- wger
volumes:
- static:/wger/static:ro
- media:/wger/media:ro
healthcheck:
test: service nginx status
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
wger:
build: wger
depends_on:
wger-db:
condition: service_healthy
wger-cache:
condition: service_healthy
env_file:
- ./wger/config/prod.env
volumes:
- static:/home/wger/static
- media:/home/wger/media
ports:
- "8000"
healthcheck:
test: wget --no-verbose --tries=1 --spider http://localhost
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
wger-db:
image: postgres:12-alpine
environment:
- POSTGRES_USER=wger
- POSTGRES_PASSWORD=wger
- POSTGRES_DB=wger
volumes:
- postgres-data:/var/lib/postgresql/data/
expose:
- 5432
healthcheck:
test: pg_isready -U wger
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
wger-cache:
image: redis
expose:
- 6379
healthcheck:
test: redis-cli ping
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
volumes:
postgres-data:
static:
media:
I use docker compose to run the builds.
Mhhh, but that still shouldn't change in any way what happens during build. Strange. I will try to reproduce this with your setup
I will try a complete rebuild too
edit: Same error
Have you had a chance to reproduce this?
Hi! Sorry, not yet
So I've finally taken a look at this and everything seems to work fine
I have used your combined dockerfile, for the docker-compose.yml I had to rename some services and used the image directly (without build path)
is this still relevant?
Steps to Reproduce
I have built wger on a Pi in a docker container using the docker files inside /extra/docker.
Expected results: Successful yarn
run v1.22.19
Actual results:
Looking through the repo, it seems the wger/core/static/yarn dir does not exist. Should it exist?