Created
November 1, 2023 15:02
-
-
Save elico/da5e396200398d559fea90e7277d540c to your computer and use it in GitHub Desktop.
Redwood simple container build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
IMAGE_NAME="redwood" | |
TAG="latest" | |
podman build -t "${IMAGE_NAME}:${TAG}" . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Alpine version for the runner contianer | |
ARG ALPINE_VERSION=latest | |
# golang builder image | |
FROM golang:1.21-bullseye AS builder | |
WORKDIR /build | |
RUN git clone https://github.com/andybalholm/redwood /build/redwood && \ | |
cd /build/redwood && \ | |
CGO_ENABLED=0 go build -buildvcs=false -pgo=auto -ldflags="-w -s -X 'main.Version=$(git describe --tags)'" -o /build/app . \ | |
&& git clone https://github.com/andybalholm/redwood-config.git /build/redwood-config | |
# Final runner image | |
FROM alpine:${ALPINE_VERSION} AS runner | |
# Copy in config & app binary | |
COPY --from=builder /build/app /app | |
COPY --from=builder /build/redwood-config /etc/redwood | |
RUN mkdir -p /var/log/redwood | |
# Expose the default ports from redwood-config | |
EXPOSE 6502 6510 | |
# Run the app | |
ENTRYPOINT [ "/app" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment