Initial commit of files

This commit is contained in:
Jamie Curnow
2021-04-28 12:11:55 +10:00
parent 24fa22ba4f
commit b51a2a5efd
12 changed files with 481 additions and 0 deletions
+87
View File
@@ -0,0 +1,87 @@
#############
# Go Builder
#############
FROM --platform=${TARGETPLATFORM:-linux/amd64} golang as go
ENV MKCERT_VERSION=1.4.2
RUN mkdir /workspace
WORKDIR /workspace
RUN go get github.com/amacneil/dbmate
RUN wget -O mkcert.tgz "https://github.com/FiloSottile/mkcert/archive/v${MKCERT_VERSION}.tar.gz"
RUN tar -xzf mkcert.tgz
WORKDIR "/workspace/mkcert-${MKCERT_VERSION}"
RUN go build -ldflags "-X main.Version=v${MKCERT_VERSION}" -o /bin/mkcert
#############
# Nginx Builder
#############
FROM --platform=${TARGETPLATFORM:-linux/amd64} debian:stable-slim as builder
ARG OPENRESTY_VERSION
ARG LUA_VERSION
ARG LUAROCKS_VERSION
RUN apt-get update \
&& apt-get install -y wget build-essential libreadline-dev openssl unzip libncurses-dev libpcre3-dev libssl-dev zlib1g-dev
# Lua build
ADD ./scripts/build-lua /tmp/build-lua
RUN /tmp/build-lua
# Nginx build
ADD ./scripts/build-openresty /tmp/build-openresty
RUN /tmp/build-openresty
#############
# Final Image
#############
FROM --platform=${TARGETPLATFORM:-linux/amd64} debian:stable-slim
LABEL maintainer="Jamie Curnow <jc@jc21.com>"
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Env var for bashrc
ARG OPENRESTY_VERSION
ENV OPENRESTY_VERSION=${OPENRESTY_VERSION}
ARG TARGETPLATFORM
RUN echo "Base: debian:stable-slim, ${TARGETPLATFORM:-linux/amd64}" > /built-for-arch
# OpenResty uses LuaJIT which has a dependency on GCC
RUN apt-get update \
&& apt-get install -y curl figlet openssl libpcre3 zlib1g apache2-utils tzdata perl libreadline7 unzip libncurses6 make gcc \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ADD ./files/.bashrc /root/.bashrc
# Copy lua and luarocks builds from first image
COPY --from=builder /tmp/lua /tmp/lua
COPY --from=builder /tmp/luarocks /tmp/luarocks
ADD ./scripts/install-lua /tmp/install-lua
# Copy openresty build from first image
COPY --from=builder /tmp/openresty /tmp/openresty
ADD ./scripts/install-openresty /tmp/install-openresty
# Copy golang built packages
COPY --from=go /bin/mkcert /bin/mkcert
COPY --from=go /go/bin/dbmate /bin/dbmate
RUN /tmp/install-lua \
&& /tmp/install-openresty \
&& rm -f /tmp/install-lua \
&& rm -f /tmp/install-openresty \
&& apt-get remove -y make gcc \
&& apt-get autoremove -y
LABEL org.label-schema.schema-version="1.0" \
org.label-schema.license="MIT" \
org.label-schema.name="nginx-full" \
org.label-schema.description="A base image for use by Nginx Proxy Manager" \
org.label-schema.url="https://github.com/jc21/docker-nginx-full" \
org.label-schema.vcs-url="https://github.com/jc21/docker-nginx-full.git" \
org.label-schema.cmd="docker run --rm -ti jc21/nginx-full:latest"
+28
View File
@@ -0,0 +1,28 @@
FROM --platform=${TARGETPLATFORM:-linux/amd64} golang as go
FROM --platform=${TARGETPLATFORM:-linux/amd64} jc21/nginx-full:${BASE_TAG:-latest}
ARG TARGETPLATFORM
RUN echo "Golang: jc21/nginx-full:${BASE_TAG:-latest}, ${TARGETPLATFORM:-linux/amd64}" >> /built-for-arch
LABEL maintainer="Jamie Curnow <jc@jc21.com>"
RUN apt-get update \
&& apt-get install -y wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# copy go from golang
COPY --from=go /usr/local/go /usr/local/go
ENV GOPATH=/opt/go PATH="/usr/local/go/bin:$PATH:/opt/go/bin"
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" \
&& chmod -R 777 "$GOPATH" \
&& echo "====> ${TARGETPLATFORM}: $(go version)"
WORKDIR /root
# Gotools
RUN if [ "$TARGETPLATFORM" == "" ] || [ "$TARGETPLATFORM" == "linux/amd64" ]; then cd /usr && wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.39.0; fi
RUN go get -u github.com/kyoh86/richgo \
&& rm -rf /root/.cache/go-build
+19
View File
@@ -0,0 +1,19 @@
FROM --platform=${TARGETPLATFORM:-linux/amd64} jc21/nginx-full:${BASE_TAG:-latest}
LABEL maintainer="Jamie Curnow <jc@jc21.com>"
ARG TARGETPLATFORM
RUN echo "Node: jc21/nginx-full:${BASE_TAG:-latest}, ${TARGETPLATFORM:-linux/amd64}" >> /built-for-arch
ENV CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
RUN curl -fsSL https://deb.nodesource.com/setup_15.x | bash - \
&& apt-get update \
&& apt-get install -y gcc make g++ git nodejs \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& npm install -g yarn
# Check nodejs works on this architecture
COPY ./files/test.js /tmp/test.js
RUN node /tmp/test.js \
&& rm -f /tmp/test.js