Browse Source

create docker image

master
François 4 months ago
parent
commit
4c0af57e01
  1. 68
      Dockerfile
  2. 3
      Makefile
  3. 18
      docker-compose.yml
  4. 2
      src/cpp/server.cpp

68
Dockerfile

@ -0,0 +1,68 @@
# docker build -t depollueur . -f ./docker/Dockerfile
# two stage building
# 1) install compiler and compile filter
# 2) copy filter and install postfix
# Doxkerfile patern from https://vsupalov.com/cache-docker-build-dependencies-without-volume-mounting/
FROM debian as intermediate_depollueur
########################################
RUN apt-get update && apt-get -y autoremove
RUN apt-get -y install locales locales-all
RUN sed -i '/fr_FR.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
ENV LC_ALL fr_FR.UTF-8
ENV LANG fr_FR.UTF-8
ENV LANGUAGE fr_FR:fr
RUN update-locale LANG=fr_FR.UTF-8
RUN apt-get -y install emacs elpa-php-mode apg
RUN apt-get -y install apg dos2unix
# creation du user filter,son repertoire home, copie des fichiers
RUN mkdir /home/filter ; useradd -d /home/filter filter ; chown filter /home/filter
########## >>> ce qui suit va être jetté
RUN apt-get install -y --fix-missing doxygen git \
build-essential make g++ libboost-program-options-dev libboost-system-dev libboost-filesystem-dev libcurl4-gnutls-dev libssl-dev
WORKDIR /home/
RUN git clone https://git.kaz.bzh/KAZ/depollueur.git
WORKDIR /home/depollueur/
RUN make
RUN cp build/out/* /home/filter/
RUN cp src/bash/* /home/filter/
########## <<< on ne garde que le répertoire ci-dessous
##########################################################################
# ###################################################################### #
# # # #
# # On jette tous ce qui est au-dessus pour ne garder que /home/filter # #
# # # #
# ###################################################################### #
##########################################################################
FROM debian
########################################
RUN apt-get update && apt-get -y autoremove
RUN apt-get -y install locales locales-all
RUN sed -i '/fr_FR.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
ENV LC_ALL fr_FR.UTF-8
ENV LANG fr_FR.UTF-8
ENV LANGUAGE fr_FR:fr
RUN update-locale LANG=fr_FR.UTF-8
RUN apt-get -y install emacs elpa-php-mode apg
RUN apt-get -y install apg dos2unix
# creation du user filter,son repertoire home, copie des fichiers
RUN mkdir /home/filter ; useradd -d /home/filter filter ; chown filter /home/filter
########## >>> On fait excatement la même chose que la première fois *
RUN apt-get -y install libboost-program-options-dev libboost-system-dev libboost-filesystem-dev libcurl4-gnutls-dev
########## pour profiter du cahe des couche de docker
COPY --from=intermediate_depollueur /home/filter /home/filter
########## <<< mais cette fois on n'installe pas le compilo
RUN chown filter /home/filter/*; chmod a+rx /home/filter/*
# pour le confort : modif du .bashrc de root
RUN sed -i 's/# alias/alias/g' /root/.bashrc
ENTRYPOINT ["/home/filter/server"]
EXPOSE 8080

3
Makefile

@ -94,6 +94,9 @@ $(TSRV_PRG): $(TSRV_OUT)
$(TSRV_OUT): $(TSRV_OBJ)
$(CC) $(TSRV_OBJ) $(IFLAGS) -cpp -L$(LIB_DIR) $(LFLAGS) -o $@
image:
docker build -t depollueur . -f ./Dockerfile
doc:
doxygen src/Doxyfile

18
docker-compose.yml

@ -0,0 +1,18 @@
version: '3.3'
services:
depollueur:
# ports:
# - 8088:80
image: depollueur
container_name: depollueurServ
# restart: ${restartPolicy}
volumes:
- mailLog:/var/log/mail
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
volumes:
mailLog:
# config:

2
src/cpp/server.cpp

@ -62,7 +62,7 @@ const string LAST_VERSION (LAST_VERSION_NUM+" "+LAST_VERSION_DATE+" server");
#define PORT 8080
const string BASH ("/bin/bash");
const string FILTER_CMD ("src/bash/testCopyInOut.sh");
const string FILTER_CMD ("/home/filter/testCopyInOut.sh");
// ================================================================================
static options_description mainDescription ("Main options", getCols ());

Loading…
Cancel
Save