oef/Dockerfile.aws

65 lines
1.3 KiB
Text
Raw Normal View History

2020-03-02 13:45:46 +01:00
############################
# STEP 1 build executable binary
############################
FROM golang:alpine AS builder
# Install git.
# Git is required for fetching the dependencies.
RUN apk update && apk add --no-cache git
2020-02-21 11:43:01 +01:00
ENV PATH=$PATH:/src/oef/
RUN mkdir -p /src/oef
ADD . /src/oef
COPY config/config.aws.yaml /src/oef/config/config.yaml
WORKDIR /src/oef/
2020-03-02 13:45:46 +01:00
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o oef *.go
# RUN go build -o oef *.go
############################
# STEP 2 build a small image
############################
FROM scratch
# Copy our static executable.
COPY --from=builder /src/oef/oef /src/oef/oef
# Copy config file
COPY --from=builder /src/oef/config/config.yaml /src/oef/config/config.yaml
# Copy templates
COPY --from=builder /src/oef/templates /src/oef/templates
# Copy dist
COPY --from=builder /src/oef/dist /src/oef/dist
# Copy VERSION file
COPY --from=builder /src/oef/VERSION /src/oef/VERSION
2020-03-02 13:45:46 +01:00
WORKDIR /src/oef/
2020-03-02 13:45:46 +01:00
# Run the oef binary.
2020-02-21 11:43:01 +01:00
ENTRYPOINT ["/src/oef/oef"]
2020-02-25 13:50:48 +01:00
EXPOSE 80
2020-03-02 13:45:46 +01:00
# FROM golang:latest
# ENV PATH=$PATH:/src/oef/
# RUN mkdir -p /src/oef
# ADD . /src/oef
# COPY config/config.aws.yaml /src/oef/config/config.yaml
# WORKDIR /src/oef/
# RUN go build -o oef *.go
# ENTRYPOINT ["/src/oef/oef"]
# EXPOSE 80