Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using multi-stage build #27

Merged
merged 5 commits into from Sep 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion .travis.yml
@@ -1,5 +1,10 @@
sudo: required

addons:
apt:
packages:
- docker-ce

services:
- docker

Expand All @@ -8,4 +13,4 @@ language: c
before_install:
- docker pull alpine:3.5

script: docker build -t export-service .
script: docker build -t export-service .
29 changes: 9 additions & 20 deletions Dockerfile
@@ -1,30 +1,19 @@
FROM alpine:3.5
FROM databoxsystems/base-image-ocaml:alpine-3.4_ocaml-4.04.2 as BUILDER

LABEL distro_style="apk" distro="alpine" distro_long="alpine" arch="x86_64" ocaml_version="4.04.0" opam_version="1.2" operatingsystem="linux"
WORKDIR /export-service
ADD . .

RUN apk update && apk upgrade \
&& apk add sudo \
&& adduser -S databox \
&& echo 'databox ALL=(ALL:ALL) NOPASSWD:ALL' > /etc/sudoers.d/databox \
&& chmod 440 /etc/sudoers.d/databox \
&& chown root:root /etc/sudoers.d/databox \
&& sed -i.bak 's/^Defaults.*requiretty//g' /etc/sudoers
RUN opam pin add -y export-service /export-service

USER databox
WORKDIR /home/databox

ADD . export-service
FROM alpine:3.4

RUN sudo apk add alpine-sdk bash ncurses-dev \
&& sudo apk add opam \
&& cd export-service \
&& sudo chmod +x install.sh && sync \
&& ./install.sh \
&& sudo apk del alpine-sdk bash ncurses-dev \
&& sudo apk del opam
WORKDIR /core-export-service
RUN apk update && apk add libsodium-dev gmp-dev
COPY --from=BUILDER /home/opam/.opam/4.04.2/bin/export-service service

EXPOSE 8080

LABEL databox.type="export-service"

ENTRYPOINT ["./service"]
CMD ["./service"]
27 changes: 0 additions & 27 deletions Dockerfile-dev

This file was deleted.