forked from TykTechnologies/tyk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
72 lines (49 loc) · 2.08 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
FROM debian:bullseye AS assets
# This Dockerfile facilitates bleeding edge development docker image builds
# directly from source. To build a development image, run `make docker`.
# If you need to tweak the environment for testing, you can override the
# `GO_VERSION` and `PYTHON_VERSION` as docker build arguments.
ARG GO_VERSION=1.19.5
ARG PYTHON_VERSION=3.7.13
WORKDIR /assets
RUN apt update && apt install wget -y && \
wget -q https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz && \
wget -q https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz
FROM debian:bullseye
ARG GO_VERSION=1.19.5
ARG PYTHON_VERSION=3.7.13
COPY --from=assets /assets/ /tmp/
WORKDIR /tmp
# Install Go
ENV PATH=$PATH:/usr/local/go/bin
RUN tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz && \
go version
# Build essentials
RUN apt update && apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev curl wget libbz2-dev -y
# Install $PYTHON_VERSION
## This just installs whatever is is bullseye, makes docker build (fast/small)-(er)
RUN apt install python3 -y
## This runs python code slower, but the process finishes quicker
# RUN tar -xf Python-${PYTHON_VERSION}.tar.xz && ls -la && \
# cd Python-${PYTHON_VERSION}/ && \
# ./configure --enable-shared && make build_all && \
# make altinstall && \
# ldconfig $PWD
## This runs python code faster, but is expensive to build and runs regression tests
# RUN tar -xf Python-${PYTHON_VERSION}.tar.xz && ls -la && \
# cd Python-${PYTHON_VERSION}/ && \
# ./configure --enable-shared --enable-optimizations && make -j 2 && \
# make altinstall && \
# ldconfig $PWD
# Clean up build assets
RUN find /tmp -type f -delete
# Build gateway
RUN mkdir /opt/tyk-gateway
WORKDIR /opt/tyk-gateway
ADD . /opt/tyk-gateway
RUN go mod download && make build && go clean -modcache
COPY tyk.conf.example tyk.conf
RUN echo "Tyk: $(/opt/tyk-gateway/tyk --version 2>&1)" && \
echo "Go: $(go version)" && \
echo "Python: $(python3 --version)"
ENTRYPOINT ["/opt/tyk-gateway/tyk"]