greatly simplify Dockerfile

This commit is contained in:
es183923
2022-04-04 18:58:53 -04:00
committed by GitHub
parent 1932d3ff41
commit f0732f09a4

View File

@@ -1,27 +1,13 @@
FROM golang:1.16.2-alpine3.13 as builder
WORKDIR /app
COPY . ./
# This is where one could build the application code as well.
FROM alpine:latest as tailscale
WORKDIR /app
COPY . ./
ENV TSFILE=tailscale_1.20.4_amd64.tgz
RUN wget https://pkgs.tailscale.com/stable/${TSFILE} && \
tar xzf ${TSFILE} --strip-components=1
COPY . ./
FROM alpine:latest
RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/*
# Copy binary to production image
COPY --from=builder /app/start.sh /app/start.sh
COPY --from=tailscale /app/tailscaled /app/tailscaled
COPY --from=tailscale /app/tailscale /app/tailscale
RUN mkdir -p /var/run/tailscale /var/cache/tailscale /var/lib/tailscale
RUN apk update \
&& apk add curl openrc \
&& rm -rf /var/cache/apk/*
RUN curl -fsSL https://tailscale.com/install.sh | sh
COPY . .
# Run on container startup.
RUN chmod +x /app/start.sh
CMD ["/app/start.sh"]
CMD ["/app/start.sh"]