This repository has been archived by the owner on Sep 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dockerfile to build example container
- Loading branch information
Showing
1 changed file
with
22 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,28 @@ | ||
FROM debian:buster-slim | ||
MAINTAINER Mark Feldhousen <mark.feldhousen@trio.dhs.gov> | ||
FROM python:3.7-alpine | ||
LABEL maintainer="mark.feldhousen@trio.dhs.gov" | ||
|
||
RUN apt-get update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ | ||
ca-certificates \ | ||
diceware \ | ||
dovecot-imapd \ | ||
dovecot-lmtpd \ | ||
gettext-base \ | ||
mailutils \ | ||
opendkim \ | ||
opendkim-tools \ | ||
opendmarc \ | ||
postfix \ | ||
procmail \ | ||
sasl2-bin \ | ||
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
RUN adduser mailarchive --quiet --disabled-password \ | ||
--shell /usr/sbin/nologin --gecos "Mail Archive" | ||
ARG CISA_UID=421 | ||
ENV CISA_HOME="/home/cisa" | ||
ENV ECHO_MESSAGE="Hello World from Dockerfile" | ||
|
||
USER root | ||
WORKDIR /root | ||
RUN addgroup --system --gid ${CISA_UID} cisa \ | ||
&& adduser --system --uid ${CISA_UID} --ingroup cisa cisa | ||
|
||
# make backups of configurations. These are modified at startup. | ||
RUN mv /etc/postfix/master.cf /etc/postfix/master.cf.orig | ||
RUN mv /etc/default/opendkim /etc/default/opendkim.orig | ||
RUN mv /etc/default/opendmarc /etc/default/opendmarc.orig | ||
RUN apk --update --no-cache add \ | ||
ca-certificates \ | ||
git \ | ||
openssl \ | ||
py-pip | ||
|
||
COPY ./src/templates ./templates/ | ||
COPY ./src/docker-entrypoint.sh . | ||
WORKDIR ${CISA_HOME} | ||
# TODO remove branch | ||
RUN git clone --branch improvement/data https://github.com/cisagov/skeleton-python-library.git . && \ | ||
pip install --requirement requirements.txt && \ | ||
ln -snf /run/secrets/quote.txt src/example/data/secret.txt | ||
|
||
VOLUME ["/var/log", "/var/spool/postfix"] | ||
EXPOSE 25/TCP 587/TCP 993/TCP | ||
USER cisa | ||
|
||
ENTRYPOINT ["./docker-entrypoint.sh"] | ||
CMD ["postfix", "-v", "start-fg"] | ||
EXPOSE 8080/TCP | ||
VOLUME ["/var/log"] | ||
ENTRYPOINT ["example"] | ||
CMD ["--log-level", "DEBUG"] |