FROM golang:alpine as build RUN apk update RUN apk upgrade RUN apk add --no-cache build-base COPY . /app WORKDIR /app ARG version RUN VERSION=$version make build FROM alpine:latest RUN apk update RUN apk upgrade RUN apk add --no-cache git openssh COPY --from=build /app/bin /app/bin RUN ln -s /app/bin/goit-shell /usr/local/bin/goit-shell RUN ssh-keygen -A RUN sed -i 's/^#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config RUN addgroup -g 973 -S git RUN adduser -g git -s /bin/sh -G git -S -u 973 git RUN sed -i 's/^git:!:/git:*:/' /etc/shadow RUN mkdir -p /home/git/.config /home/git/.local/share /home/git/.local/state RUN chown -R git:git /home/git/.config /home/git/.local WORKDIR /app EXPOSE 8080 EXPOSE 22 VOLUME /etc/goit /var/lib/goit /var/log/goit RUN cat < /app/bin/launch.sh #!/bin/sh -e /usr/sbin/sshd -D & su git -c "/app/bin/goit \$@" EOF ENTRYPOINT ["sh", "/app/bin/launch.sh"]