diff --git a/docker-compose.production.yml b/docker-compose.production.yml index fe232e1..dbacff4 100644 --- a/docker-compose.production.yml +++ b/docker-compose.production.yml @@ -1,6 +1,11 @@ services: - oculus: + monitor: build: - context: ./docker/oculus/ + context: ./docker/monitor/ dockerfile: Dockerfile.production - image: git.nixc.us/colin/oculus:production \ No newline at end of file + image: git.nixc.us/colin/oculus:production-monitor + reporter: + build: + context: ./docker/reporter/ + dockerfile: Dockerfile.production + image: git.nixc.us/colin/oculus:production-reporter diff --git a/docker-compose.staging.yml b/docker-compose.staging.yml index b98cdda..0cdb721 100644 --- a/docker-compose.staging.yml +++ b/docker-compose.staging.yml @@ -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 diff --git a/docker/monitor/Dockerfile b/docker/monitor/Dockerfile new file mode 100644 index 0000000..f9e3ec8 --- /dev/null +++ b/docker/monitor/Dockerfile @@ -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"] diff --git a/docker/monitor/Dockerfile.production b/docker/monitor/Dockerfile.production new file mode 100644 index 0000000..555eb93 --- /dev/null +++ b/docker/monitor/Dockerfile.production @@ -0,0 +1 @@ +FROM git.nixc.us/colin/oculus:staging-monitor diff --git a/docker/oculus/notify.sh b/docker/monitor/notify.sh similarity index 100% rename from docker/oculus/notify.sh rename to docker/monitor/notify.sh diff --git a/docker/oculus/Dockerfile b/docker/oculus/Dockerfile deleted file mode 100644 index 0799552..0000000 --- a/docker/oculus/Dockerfile +++ /dev/null @@ -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"] - diff --git a/docker/oculus/Dockerfile.production b/docker/oculus/Dockerfile.production deleted file mode 100644 index 65f2ece..0000000 --- a/docker/oculus/Dockerfile.production +++ /dev/null @@ -1 +0,0 @@ -FROM git.nixc.us/colin/oculus:staging diff --git a/docker/reporter/Dockerfile b/docker/reporter/Dockerfile new file mode 100644 index 0000000..343b2eb --- /dev/null +++ b/docker/reporter/Dockerfile @@ -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"] diff --git a/docker/reporter/Dockerfile.production b/docker/reporter/Dockerfile.production new file mode 100644 index 0000000..8011e21 --- /dev/null +++ b/docker/reporter/Dockerfile.production @@ -0,0 +1 @@ +FROM git.nixc.us/colin/oculus:staging-reporter \ No newline at end of file