Skip to content

Instantly share code, notes, and snippets.

@elico
Created November 1, 2023 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elico/da5e396200398d559fea90e7277d540c to your computer and use it in GitHub Desktop.
Save elico/da5e396200398d559fea90e7277d540c to your computer and use it in GitHub Desktop.
Redwood simple container build
#!/usr/bin/env bash
IMAGE_NAME="redwood"
TAG="latest"
podman build -t "${IMAGE_NAME}:${TAG}" .
# 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