Created
September 27, 2018 12:18
-
-
Save astericky/79fa572eeadcfbd0a7dd1b3bea3bea11 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Run this from the parent directory | |
FROM golang:1.9-alpine as build_container | |
ENV APP_NAME my-app | |
ENV TARGET_DIR /go/src/github.com/MediaMath/${APP_NAME} | |
COPY . ${TARGET_DIR} | |
WORKDIR ${TARGET_DIR} | |
# Build app | |
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -a -o ${APP_NAME} . | |
FROM alpine:3.6 | |
ENV APP_NAME my-app | |
ENV TARGET_DIR /go/src/github.com/MediaMath/${APP_NAME} | |
RUN apk update && apk upgrade && apk add --no-cache curl | |
RUN mkdir -p /app /app/config /app/views | |
WORKDIR /app | |
# Copy files from build_container to current container | |
COPY --from=build_container ${TARGET_DIR}/config/config.json config/ | |
COPY --from=build_container ${TARGET_DIR}/${APP_NAME} . | |
ENTRYPOINT ["./my-app"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment