Skip to content

Commit

Permalink
🐛 Fix bug in docker images
Browse files Browse the repository at this point in the history
  • Loading branch information
llaumgui committed May 1, 2024
1 parent 7ffb3a5 commit f306a76
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 23 deletions.
8 changes: 7 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
.git
.github
.git
.pytest_cache
.vscode
build
dist
env
seedboxsync.egg-info
55 changes: 35 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,49 @@
FROM python:3.12-alpine
#
# Build
#
FROM python:3.12-alpine as builder

WORKDIR /src

ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

COPY . /src
RUN pip install --no-cache-dir cement && \
pip wheel --no-cache-dir --no-deps --wheel-dir /src/wheels -r requirements.txt && \
pip wheel --no-cache-dir --no-deps --wheel-dir /src/wheels .


LABEL maintainer="Guillaume Kulakowski <guillaume@kulakowski.fr>"
ENV PS1="\[\e[0;33m\]|> seedboxsync <| \[\e[1;35m\]\W\[\e[0m\] \[\e[0m\]# "

#
# Prod
#
FROM python:3.12-alpine

# Non root user
RUN adduser -D seedboxsync

WORKDIR /src
COPY . /src

# Add cement for setup.py before
RUN pip install --no-cache-dir cement && \
# Install SeedboxSync \
pip install --no-cache-dir . && \
# System folders \
mkdir /config && \
mkdir /download && \
# System folders
RUN mkdir /config && \
mkdir /downloads && \
mkdir /watch && \
chown -R seedboxsync:seedboxsync /config /download /watch && \
# Seedboxsync folders
mkdir ~seedboxsync/.config && \
ln -s /config ~seedboxsync/.config/seedboxsync && \
ln -s /download ~seedboxsync/Downloads && \
ln -s /watch ~seedboxsync/watch && \
cp config/seedboxsync.yml.example /config/seedboxsync.yml && \
chown -R seedboxsync:seedboxsync ~seedboxsync/.config && \
# Cleanup \
chown -R seedboxsync:seedboxsync /config /downloads /watch

# Add cement for setup.py before
COPY --from=builder /src/wheels wheels
RUN pip install --no-cache-dir wheels/* && \
rm -rf /src

USER seedboxsync
# Seedboxsync folders
RUN mkdir ~seedboxsync/.config && \
ln -s /config ~seedboxsync/.config/seedboxsync && \
ln -s /downloads ~seedboxsync/Downloads && \
ln -s /watch ~seedboxsync/watch && \
cp /usr/local/config/seedboxsync.yml.example /config/seedboxsync.yml

WORKDIR /home/seedboxsync

ENTRYPOINT ["/usr/local/bin/seedboxsync"]
4 changes: 2 additions & 2 deletions docs/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ docker pull ghcr.io/llaumgui/seedboxsync
docker run --rm \
--volume /data/seedboxsync/config:/config/seedboxsync.yml \
--volume /data/seedboxsync/watch:/watch \
--volume /data/seedboxsync/download:/download \
--volume /data/seedboxsync/downloads:/downloads \
ghcr.io/llaumgui/seedboxsync:latest --help
```

Expand All @@ -43,6 +43,6 @@ COMMAND="$@"
docker run --rm \
--volume /data/seedboxsync:/config \
--volume /data/seedboxsync/watch:/watch \
--volume /data/seedboxsync/download:/download \
--volume /data/seedboxsync/downloads:/downloads \
${CONTAINER_NAME} ${COMMAND}
```
7 changes: 7 additions & 0 deletions seedboxsync/core/dao/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2024 Guillaume Kulakowski <guillaume@kulakowski.fr>
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
#
7 changes: 7 additions & 0 deletions seedboxsync/core/sync/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2024 Guillaume Kulakowski <guillaume@kulakowski.fr>
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
#

0 comments on commit f306a76

Please sign in to comment.