49 lines
1.4 KiB
Docker
49 lines
1.4 KiB
Docker
|
# Dockerfile References: https://docs.docker.com/engine/reference/builder/
|
||
|
# This dockerfile uses a multi-stage build system to reduce the image footprint.
|
||
|
|
||
|
######-
|
||
|
# Start from the latest golang base image as builder image (only used to compile the code)
|
||
|
######-
|
||
|
FROM golang:1.15 as builder
|
||
|
|
||
|
RUN mkdir /build
|
||
|
|
||
|
# Copy the source from the current directory to the Working Directory inside the container
|
||
|
ADD . /build/
|
||
|
|
||
|
# Set the Current Working Directory inside the container
|
||
|
WORKDIR /build
|
||
|
|
||
|
# Build the Go app
|
||
|
RUN make build
|
||
|
|
||
|
######-
|
||
|
# Here starts the main image
|
||
|
######-
|
||
|
FROM debian:buster
|
||
|
|
||
|
# Setup timezone
|
||
|
ENV TZ=Europe/Vienna
|
||
|
|
||
|
# GOSS for container health checks
|
||
|
ENV GOSS_VERSION v0.3.14
|
||
|
RUN apt-get update && apt-get upgrade -y && \
|
||
|
apt-get install --no-install-recommends -y moreutils ca-certificates curl && \
|
||
|
rm -rf /var/cache/apt /var/lib/apt/lists/*; \
|
||
|
curl -L https://github.com/aelsabbahy/goss/releases/download/$GOSS_VERSION/goss-linux-amd64 -o /usr/local/bin/goss && \
|
||
|
chmod +rx /usr/local/bin/goss && \
|
||
|
goss --version
|
||
|
|
||
|
COPY --from=builder /build/dist/wg-portal /app/
|
||
|
COPY --from=builder /build/dist/assets /app/assets
|
||
|
COPY --from=builder /build/scripts /app/
|
||
|
|
||
|
# Set the Current Working Directory inside the container
|
||
|
WORKDIR /app
|
||
|
|
||
|
# Command to run the executable
|
||
|
CMD [ "/app/wg-portal" ]
|
||
|
|
||
|
HEALTHCHECK --interval=1m --timeout=10s \
|
||
|
CMD /app/docker-healthcheck.sh
|