Skip to content

Commit

Permalink
Add a first version of Dockerfile and compose
Browse files Browse the repository at this point in the history
issues:
- pip installs into user home, which is on a volume. not good!
- we install from pypi, we'd also want to install from git source at
  some point
  • Loading branch information
JOJ0 committed Aug 17, 2024
1 parent 2c162ed commit 446acca
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM python:3.11-slim
# Create user, we need $HOME/.config
RUN useradd --create-home --shell /bin/bash synapseadmin
# Create app dir and switch context (irrelevant on pypi inst)
RUN mkdir /synadm_app
WORKDIR /synadm_app
COPY . .

WORKDIR /home/synapseadmin
RUN \
chown -R synapseadmin:synapseadmin /home/synapseadmin && \
chmod -R 755 /home/synapseadmin
# User home on volume (will be prepoluated on first init)
VOLUME /home/synapseadmin
# Run as non-root user from here
USER synapseadmin
# Add user bin to path
ENV PATH="/home/synapseadmin/.local/bin:$PATH"
# Install synadm from pypi
RUN pip install --upgrade pip && \
pip install --no-cache-dir synadm && \
chown -R synapseadmin:synapseadmin /home/synapseadmin && \
chmod -R 755 /home/synapseadmin

9 changes: 9 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
services:
synadm_app:
build: .
container_name: synadm
image: synadm_image
#volumes:
# - ./home/synapseadmin:/home/synapseadmin
stdin_open: true
tty: true

0 comments on commit 446acca

Please sign in to comment.