dockerfile

This commit is contained in:
Darren 2023-09-19 12:54:20 +08:00 committed by GitHub
parent 462b558af6
commit a91f4112ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 33 deletions

View file

@ -1,48 +1,45 @@
FROM python:3.10-slim
# python:3.10-bullseye
# RUN apt update & apt install wget git curl unzip
FROM python:3.10-bullseye
LABEL maintainer="Websoft9<help@websoft9.com>"
LABEL version="0.0.1"
LABEL version="0.8.17"
ENV LIBRARY_VERSION=v0.5.4
# RUN mkdir /usr/src/app/config
WORKDIR /usr/websoft9
RUN apt update
RUN apt install -y supervisor wget git zip
RUN wget https://github.com/Websoft9/docker-library/archive/refs/tags/$LIBRARY_VERSION.zip -O /usr/websoft9/library.zip
RUN unzip library.zip
RUN mkdir credentials
RUN echo "This folder stored the credentials of other services that apphub will connect" > credentials/readme
# Media and master data from Contentful
RUN wget --depth=1 https://github.com/Websoft9/plugin-appstore
RUN mv -f plugin-appstore/data ./media
# Prepare library
RUN wget https://github.com/Websoft9/docker-library/archive/refs/tags/$LIBRARY_VERSION.zip -O ./library.zip && \
unzip library.zip && \
mkdir credentials && \
echo "This folder stored the credentials of other services that apphub will connect" > credentials/readme && \
# Prepare Media and master data from Contentful
git clone --depth=1 https://github.com/Websoft9/plugin-appstore && \
mv -f plugin-appstore/data ./media
# Copy source and install pip dpendencies
# Todo: add virtualenv for Python install
COPY ../../appmanage_new ./apphub
RUN pip install -r apphub/requirements.txt
#COPY ../../appmanage_new ./apphub
#RUN pip install -r apphub/requirements.txt
# supervisor
RUN pip install supervisor
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
RUN chmod +r /etc/supervisor/conf.d/supervisord.conf
# entrypoint
COPY config/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
VOLUME /usr/websoft9/apphub/logs
VOLUME /usr/websoft9/apphub/src/conf
VOLUME /usr/websoft9/media
# Clean
# Clean cache and install files
RUN rm -rf apphub/docs apphub/tests library.zip plugin-appstore
# Expose the port in which the application will be deployed
EXPOSE 8080
ENTRYPOINT [/entrypoint.sh]
ENTRYPOINT [/entrypoint.sh]

View file

@ -1,2 +1 @@
# filename=container_name
{"username":"appuser","password":"apppassword"}

View file

@ -8,9 +8,9 @@ services:
- 127.0.0.1:9001:8080
restart: always
volumes:
- logs:/usr/websoft9/apphub/logs
- media:/usr/websoft9/media
- config:/usr/websoft9/apphub/src/conf
- logs:/websoft9/apphub/logs
- media:/websoft9/media
- config:/websoft9/apphub/src/conf
networks:
default:

5
systemd/users.sh Normal file
View file

@ -0,0 +1,5 @@
#!/bin/bash
docker cp my-container:/path/to/file websoft9-apphub:/websoft9/credentials
docker cp my-container:/path/to/file websoft9-apphub:/path/to/credentials
docker cp my-container:/path/to/file websoft9-apphub:/path/to/credentials

View file

@ -14,9 +14,3 @@ StandardError=syslog
[Install]
WantedBy=multi-user.target
internal_ip=$(ip addr show eth0 | awk '/inet /{split($2, a, "/"); print a[1]}')
nsenter -m -u -i -n -p -t 1 sh -c "sed -i '/websoft9-apphub/d' /etc/hosts"
nsenter -m -u -i -n -p -t 1 sh -c "echo $internal_ip websoft9-apphub>> /etc/hosts"