mirror of
https://github.com/h44z/wg-portal.git
synced 2025-09-13 14:31:15 +00:00
* Improved Makefile * Multiarch Docker build (amd64, arm64 and armv7) * closes #104
This commit is contained in:
22
Dockerfile
22
Dockerfile
@@ -12,6 +12,10 @@ ENV ENV_BUILD_IDENTIFIER=$BUILD_IDENTIFIER
|
||||
ARG BUILD_VERSION
|
||||
ENV ENV_BUILD_VERSION=$BUILD_VERSION
|
||||
|
||||
# populated by BuildKit
|
||||
ARG TARGETPLATFORM
|
||||
ENV ENV_TARGETPLATFORM=$TARGETPLATFORM
|
||||
|
||||
RUN mkdir /build
|
||||
|
||||
# Copy the source from the current directory to the Working Directory inside the container
|
||||
@@ -20,16 +24,8 @@ ADD . /build/
|
||||
# Set the Current Working Directory inside the container
|
||||
WORKDIR /build
|
||||
|
||||
# Workaround for failing travis-ci builds
|
||||
RUN rm -rf ~/go; rm -rf go.sum
|
||||
|
||||
# Download dependencies
|
||||
RUN curl -L https://git.prolicht.digital/pub/healthcheck/-/releases/v1.0.1/downloads/binaries/hc -o /build/hc; \
|
||||
chmod +rx /build/hc; \
|
||||
echo "Building version: $ENV_BUILD_IDENTIFIER-$ENV_BUILD_VERSION"
|
||||
|
||||
# Build the Go app
|
||||
RUN go clean -modcache; go mod tidy; make build-docker
|
||||
RUN echo "Building version '$ENV_BUILD_IDENTIFIER-$ENV_BUILD_VERSION' for platform $ENV_TARGETPLATFORM"; make build
|
||||
|
||||
######-
|
||||
# Here starts the main image
|
||||
@@ -44,16 +40,14 @@ COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||
COPY --from=builder /etc/passwd /etc/passwd
|
||||
COPY --from=builder /etc/group /etc/group
|
||||
|
||||
# Import healthcheck binary
|
||||
COPY --from=builder /build/hc /app/hc
|
||||
|
||||
# Copy binaries
|
||||
COPY --from=builder /build/dist/wgportal /app/wgportal
|
||||
COPY --from=builder /build/dist/wg-portal /app/wg-portal
|
||||
COPY --from=builder /build/dist/hc /app/hc
|
||||
|
||||
# Set the Current Working Directory inside the container
|
||||
WORKDIR /app
|
||||
|
||||
# Command to run the executable
|
||||
CMD [ "/app/wgportal" ]
|
||||
CMD [ "/app/wg-portal" ]
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 CMD [ "/app/hc", "http://localhost:11223/health" ]
|
||||
|
Reference in New Issue
Block a user