Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker #124

Merged
merged 7 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: Create and publish a Docker image

on:
push:
branches: ["docker"]
branches: ["main"]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
IMAGE_NAME: surfscz/sram-plsc

jobs:
build-and-push-image:
Expand Down
36 changes: 24 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
ARG PYTHON_VERSION=3.11-alpine
FROM python:3.8-slim-bookworm

FROM python:${PYTHON_VERSION}
# Do an initial clean up and general upgrade of the distribution
ENV DEBIAN_FRONTEND noninteractive
RUN apt clean && apt autoclean && apt update
RUN apt -y upgrade && apt -y dist-upgrade

RUN apk add py3-virtualenv py3-pytest python3-dev gcc musl-dev openldap-dev bash
# Install the packages we need
RUN apt install -y build-essential libldap2-dev libsasl2-dev git

ENV VENV /.venv
RUN virtualenv ${VENV}
ENV PATH ${VENV}/bin:$PATH
# Clean up
RUN apt autoremove -y && apt clean && apt autoclean && rm -rf /var/lib/apt/lists/*

RUN adduser -D user
RUN mkdir -p /opt/plsc

WORKDIR /app
# Set the default workdir
WORKDIR /opt/plsc

# Create pyff dir
#RUN virtualenv /opt/pyff
# RUN git clone -b main https://github.com/SURFscz/plsc.git /opt/plsc
ADD . .
RUN chown -R user:user ${VENV} .

USER user
# Copy process script
COPY misc/process.sh /opt/plsc/process.sh
RUN chmod 755 /opt/plsc/process.sh

RUN pip install --upgrade pip
RUN pip install -r requirements.txt

CMD ["./run.sh"]
# Copy entrypoint
COPY misc/entrypoint.sh /entrypoint.sh
RUN chmod 755 /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
CMD ["/opt/plsc/process.sh"]
5 changes: 5 additions & 0 deletions misc/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
# Do things we need to do before running CMD

# Hand off to the CMD
exec $@
9 changes: 9 additions & 0 deletions misc/process.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
set -e
while true
do
sleep 5m
/opt/plsc/run.sh plsc.yml
done

exit 0