Skip to content

Instantly share code, notes, and snippets.

@aniongithub
Created April 19, 2023 02:12
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 aniongithub/c457dbd657da606d9ecb290182902bc4 to your computer and use it in GitHub Desktop.
Save aniongithub/c457dbd657da606d9ecb290182902bc4 to your computer and use it in GitHub Desktop.
Dockerfile using docker-systemctl-replacement and heredoc for unit file
# syntax=docker/dockerfile:1.3-labs
# Enable heredoc syntax https://collabnix.com/using-heredocs-in-dockerfiles-simplify-your-image-building-process/
FROM ubuntu
RUN wget https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement/master/files/docker/systemctl3.py -O /usr/local/bin/systemctl &&\
chmod +x /usr/local/bin/systemctl
RUN cat <<EOF > /etc/systemd/system/memgraph.service
[Unit]
Description=Docker systemd service
DefaultDependencies=no
[Service]
Type=simple
WorkingDirectory=/working/directory/here
ExecStart=/command/to/execute/here --args-here
Restart=on-failure
RestartSec=5s
User=root
TimeoutSec=900
[Install]
WantedBy=sysinit.target
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment