Containerizing things.
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
Colin 2024-06-12 15:48:49 -04:00
parent db316cca71
commit edab2e247e
9 changed files with 63 additions and 16 deletions

View File

@ -1,6 +1,11 @@
services:
oculus:
monitor:
build:
context: ./docker/oculus/
context: ./docker/monitor/
dockerfile: Dockerfile.production
image: git.nixc.us/colin/oculus:production
image: git.nixc.us/colin/oculus:production-monitor
reporter:
build:
context: ./docker/reporter/
dockerfile: Dockerfile.production
image: git.nixc.us/colin/oculus:production-reporter

View File

@ -1,6 +1,11 @@
services:
oculus:
monitor:
build:
context: ./docker/oculus/
context: ./docker/monitor/
dockerfile: Dockerfile
image: git.nixc.us/colin/oculus:staging
image: git.nixc.us/colin/oculus:staging-monitor
reporter:
build:
context: ./docker/reporter/
dockerfile: Dockerfile
image: git.nixc.us/colin/oculus:staging-reporter

16
docker/monitor/Dockerfile Normal file
View File

@ -0,0 +1,16 @@
# Dockerfile.api
# Use the Docker-in-Docker image
FROM docker:20.10.7-dind
# Add the pre-built binary to the container
ADD https://git.nixc.us/colin/Oculus/raw/branch/main/dist/oculus_linux_amd64_api_static /oculus_api
# Ensure the binary is executable
RUN chmod +x /oculus_api
# Expose port 8080
EXPOSE 8080
# Start Docker and the API
CMD ["sh", "-c", "dockerd-entrypoint.sh & /oculus_api"]

View File

@ -0,0 +1 @@
FROM git.nixc.us/colin/oculus:staging-monitor

View File

@ -1,9 +0,0 @@
FROM alpine:latest
RUN apk update && apk add --no-cache curl bash
RUN curl -sSL https://git.nixc.us/colin/Oculus/raw/branch/main/install.sh | bash
RUN curl -sSL https://git.nixc.us/Nixius/go-glitch/raw/branch/master/install.sh | bash
COPY notify.sh /notify.sh
RUN chmod +x /notify.sh
ENV GLITCHTIP_DSN=""
CMD ["/usr/local/bin/oculus"]

View File

@ -1 +0,0 @@
FROM git.nixc.us/colin/oculus:staging

View File

@ -0,0 +1,29 @@
# 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
# Switch to the unprivileged user
USER oculus
# Set the entrypoint to the main binary
ENTRYPOINT ["/usr/local/bin/oculus_main"]

View File

@ -0,0 +1 @@
FROM git.nixc.us/colin/oculus:staging-reporter