Oculus/docker/reporter/Dockerfile

40 lines
1.3 KiB
Docker

# Stage 1: Build stage
FROM alpine:latest AS builder
# Install curl and bash
RUN apk add --no-cache curl bash
# Install go-glitch and oculus using their respective install.sh scripts
RUN curl -sSL https://git.nixc.us/Nixius/go-glitch/raw/branch/master/install.sh | bash && \
curl -sSL https://git.nixc.us/colin/Oculus/raw/branch/main/install.sh | bash
# Stage 2: Final stage
FROM alpine:latest
# Create an unprivileged user and group
RUN addgroup -S oculus && adduser -S oculus -G oculus
# Copy the necessary binaries from the build stage
COPY --from=builder /usr/local/bin/go-glitch /usr/local/bin/go-glitch
COPY --from=builder /usr/local/bin/oculus_main /usr/local/bin/oculus_main
COPY --from=builder /usr/local/bin/oculus_filter /usr/local/bin/oculus_filter
# Change ownership of the binaries to the unprivileged user
RUN chown oculus:oculus /usr/local/bin/go-glitch /usr/local/bin/oculus_main /usr/local/bin/oculus_filter
# Create the logs directory, set it as a volume, and set the appropriate permissions
RUN mkdir /logs && chown oculus:oculus /logs
VOLUME /logs
# Set the working directory to /logs
WORKDIR /logs
# Create the diffs directory within /logs
RUN mkdir /logs/diffs && chown oculus:oculus /logs/diffs
# Switch to the unprivileged user
USER oculus
# Set the entrypoint to the main binary
ENTRYPOINT ["/usr/local/bin/oculus_main"]