dockerfile multiple from code example

Example 1: docker copy from another image

FROM golang:1.7.3 AS builder
WORKDIR /go/src/github.com/alexellis/href-counter/
RUN go get -d -v golang.org/x/net/html  
COPY app.go    .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .

FROM alpine:latest  
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=builder /go/src/github.com/alexellis/href-counter/app .
CMD ["./app"]

Example 2: multiple run dockerfile

RUN cd / && \
    git clone https://github.com/ && \
    cd /fileadmin/ && \
    bundle install && \
    rake db:migrate && \
    bundle exec rails runner "eval(File.read 'createTestUser.rb')" && \
    mkdir /pending && \
    mkdir /live && \
    chmod 777 /pending && \
    chmod 777 /live

Example 3: multiple run dockerfile

RUN cd /
    git clone https://github.com/
    cd /fileadmin/
    bundle install
    rake db:migrate
    bundle exec rails runner "eval(File.read 'createTestUser.rb')"
    mkdir /pending
    mkdir /live
    chmod 777 /pending
    chmod 777 /live

Tags:

Misc Example