Skip to content

Commit

Permalink
Changing permissions for apt install
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandralazoroska committed Nov 18, 2024
1 parent 6330f99 commit 7a66113
Showing 1 changed file with 31 additions and 27 deletions.
58 changes: 31 additions & 27 deletions sddi-base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,21 @@ ENV SRC_DIR=/srv/app/src
ENV CKAN_DIR=${SRC_DIR}/ckan
ENV DATA_DIR=/srv/app/data
ENV PIP_SRC=${SRC_DIR}
ENV CKAN_INI=${APP_DIR}/production.ini
ENV CKAN_STORAGE_PATH=/var/lib/ckan
ENV UWSGI_HARAKIRI=50

USER root

# Setting the locale
# ENV LC_ALL="en_US.UTF-8"
# RUN apt-get update && apt-get install --no-install-recommends -y locales
# RUN sed -i "/$LC_ALL/s/^# //g" /etc/locale.gen
# RUN dpkg-reconfigure --frontend=noninteractive locales
# RUN update-locale LANG=${LC_ALL}
ENV LC_ALL="en_US.UTF-8"
RUN apt-get update && apt-get install --no-install-recommends -y locales
RUN sed -i "/$LC_ALL/s/^# //g" /etc/locale.gen
RUN dpkg-reconfigure --frontend=noninteractive locales
RUN update-locale LANG=${LC_ALL}

# Set timezone
RUN echo "UTC" > /etc/timezone
ENV CKAN_INI=${APP_DIR}/production.ini
ENV CKAN_STORAGE_PATH=/var/lib/ckan
RUN echo "UTC" > /etc/timezone

# Update the package lists and install required packages
RUN apt-get update && apt-get install -y \
Expand All @@ -207,18 +210,12 @@ RUN apt-get update && apt-get install -y \
proj-data \
python3-cffi \
uwsgi-plugin-python3 \
supervisor
supervisor \
sudo

# Cleanup to reduce image size
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

RUN set -ex pip install markupsafe==2.0.1 \
setuptools \
wheel \
sqlalchemy==1.4.41 \
gevent==22.10.2 \
greenlet==2.0.1

# Create SRC_DIR
RUN mkdir -p ${SRC_DIR} && \
# Link python to python3
Expand All @@ -227,6 +224,20 @@ RUN mkdir -p ${SRC_DIR} && \
# Get artifacts from build stages
COPY --from=extbuild /wheels ${APP_DIR}/ext_wheels

# Create local storage folder
RUN mkdir -p ${CKAN_STORAGE_PATH} && \
chown -R ckan:ckan ${CKAN_STORAGE_PATH} && \
chown -R ckan:ckan ${APP_DIR}

USER ckan

RUN set -ex pip install markupsafe==2.0.1 \
setuptools \
wheel \
sqlalchemy==1.4.41 \
gevent==22.10.2 \
greenlet==2.0.1

WORKDIR ${CKAN_DIR}

# ckanext-harvest ###########################################################
Expand Down Expand Up @@ -337,21 +348,14 @@ RUN set -ex && \
ckan config-tool "${CKAN_INI}" "ckan.harvest.log_scope = 0" && \
ckan config-tool "${CKAN_INI}" "ckan.harvest.log_level = debug" && \
ckan config-tool "${CKAN_INI}" "ckan.harvest.log_timeframe = 10" && \
ckan config-tool "${CKAN_INI}" "PERMANENT_SESSION_LIFETIME = 600" && \
echo "${TZ}" > /etc/timezone && \
mkdir -p ${CKAN_STORAGE_PATH} && \
chown -R ckan:ckan ${APP_DIR} ${CKAN_STORAGE_PATH} && \
# Remove wheels
ckan config-tool "${CKAN_INI}" "PERMANENT_SESSION_LIFETIME = 600"

# Remove wheels
RUN set -ex && \
rm -rf ${APP_DIR}/ext_wheels

WORKDIR ${APP_DIR}

ENV UWSGI_HARAKIRI=50

# Create local storage folder
RUN mkdir -p ${CKAN_STORAGE_PATH} && \
chown -R ckan:ckan ${CKAN_STORAGE_PATH}

# Create entrypoint directory for children image scripts
ONBUILD RUN mkdir /docker-entrypoint.d

Expand Down

0 comments on commit 7a66113

Please sign in to comment.