mirror of
https://github.com/h44z/wg-portal.git
synced 2025-09-13 14:31:15 +00:00
wip: dockerfile
This commit is contained in:
48
Dockerfile
Normal file
48
Dockerfile
Normal file
@@ -0,0 +1,48 @@
|
||||
# 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
|
Reference in New Issue
Block a user