Last active
June 3, 2021 17:03
-
-
Save rogeruiz/829516010b42962a2e4c5097b4f6caa1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tick Linux image for Ubuntu with all the necessary dependencies and | |
# environment variables. This Dockerfile can be used to test assertions that | |
# Tick was installed properly on Linux Ubuntu 18.04 and that it runs without | |
# needing to run `diesel_cli` commands to run the initial migraitons. This | |
# example is the first step to shipping a single binary for Tick cross-platform. | |
# | |
# Because of the life cycle of Docker containers, this container can only be | |
# used to run Tick commands in an ephemeral matter. Starting timers will only | |
# create timers which get destroyed when the tick command exits and the | |
# container is destroyed. | |
FROM ubuntu:18.04 | |
# Prepare the directories that are going to be used. | |
RUN mkdir -p /src | |
RUN mkdir -p /db | |
# Prepare the environment variables for Rust and Tick. | |
ENV TICK_DATABASE_FILE=/db/docker-test.db | |
ENV PATH=/root/.cargo/bin:$PATH | |
# Update all the necessary dependencies for Rust and Tick. | |
RUN apt-get update && apt-get install -y \ | |
curl \ | |
sqlite3 \ | |
build-essential \ | |
libsqlite3-dev | |
# Install Rust using Rustup. | |
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | |
# Copy the freshly cloned Tick repository to the container. | |
COPY ./tick/ /src/tick | |
# Setup the .env file for Tick compilation. | |
RUN echo "TICK_DATABASE_FILE=/db/docker-test.db" > /src/tick/.env | |
# Build Tick with Cargo | |
RUN cd /src/tick && ~/.cargo/bin/cargo clean && ~/.cargo/bin/cargo build --release | |
# Install the Tick binary in the executable path. | |
RUN mv /src/tick/target/release/tick /usr/local/bin/tick | |
# Set the entry point to the binary so that `docker build -i tick-test "help"` | |
# is equivalent to running `tick help`. | |
ENTRYPOINT [ "tick" ] |
Author
rogeruiz
commented
Jun 3, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment