Skip to content
This repository has been archived by the owner on Jan 22, 2021. It is now read-only.

Commit

Permalink
Merge pull request #43 from TykTechnologies/update-docker-file
Browse files Browse the repository at this point in the history
create new dockerfile, 53mb large, tested with helm chart
  • Loading branch information
sedkis committed Jul 2, 2020
2 parents e438234 + 743ec3a commit 31d9ce8
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions docker/controller/Dockerfile
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"]

0 comments on commit 31d9ce8

Please sign in to comment.