This repository has been archived by the owner on Jan 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from TykTechnologies/update-docker-file
create new dockerfile, 53mb large, tested with helm chart
- Loading branch information
Showing
1 changed file
with
27 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,31 @@ | ||
FROM centos | ||
# Start from the latest golang base image | ||
FROM golang:1.13 as builder | ||
|
||
RUN mkdir -p /opt/tyk-k8s | ||
COPY files/build/tyk-k8s /opt/tyk-k8s/tyk-k8s | ||
# Set the Current Working Directory inside the container | ||
WORKDIR /app | ||
|
||
# Copy go mod and sum files | ||
COPY go.mod go.sum ./ | ||
|
||
# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed | ||
RUN go mod download | ||
|
||
# Copy the source from the current directory to the Working Directory inside the container | ||
COPY . . | ||
|
||
# Build the Go app | ||
RUN CGO_ENABLED=0 go build -o tyk-k8s . | ||
|
||
|
||
######## Start a new stage from scratch ####### | ||
FROM debian:buster-slim | ||
|
||
RUN mkdir -p /opt/tyk-k8s | ||
WORKDIR /opt/tyk-k8s | ||
|
||
CMD ["/opt/goproxy/tyk-k8s", "start"] | ||
# Copy the Pre-built binary file from the previous stage | ||
COPY --from=builder /app/tyk-k8s /opt/tyk-k8s/tyk-k8s | ||
|
||
ENTRYPOINT ["./tyk-k8s"] | ||
|
||
CMD ["start"] |