Skip to content

Instantly share code, notes, and snippets.

@joshrotenberg
Created April 2, 2024 01:36
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 joshrotenberg/86b4f993dfa965c581266b331ab766da to your computer and use it in GitHub Desktop.
Save joshrotenberg/86b4f993dfa965c581266b331ab766da to your computer and use it in GitHub Desktop.
A Dockerfile to run the Oso Local Development Binary
# syntax=docker/dockerfile:1
# The Oso Local Development binary will be available at http://localhost:8080
# Test it out with the following curl command:
#
# Simple Dockerfile to run the Oso Local Development binary in a container.
#
# To build the image, run:
# docker build -t oso-local .
#
# To run the container, run:
# docker run -p 8080:8080 oso-local
#
# The container output will give you the API key.
#
# Create a simple policy and add it to the server:
# curl -H "Authorization: Bearer e_0123456789_12345_osotesttoken01xiIn" http://localhost:8080/api/policy -d '{ "filename": "string", "src": "actor User {}" }'
#
# And pull it back.
# curl -H "Authorization: Bearer e_0123456789_12345_osotesttoken01xiIn" http://localhost:8080/api/policy
#
# See https://ui.osohq.com/install/?tab=local-binary for more information.
FROM alpine:latest as base
FROM base as build
RUN apk add --no-cache curl
RUN curl -Ls https://oso-local-development-binary.s3.amazonaws.com/latest/oso-local-development-binary-linux-x86_64.tar.gz | tar xz -C /bin
RUN chmod +x /bin/standalone
FROM base AS final
COPY --from=build /bin/standalone /bin/
EXPOSE 8080
CMD [ "/bin/standalone" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment