🐛 fix running on mac

This commit is contained in:
Louis Orleans 2023-08-31 13:59:36 -07:00
parent 8a429b1609
commit e6639c8fe2
No known key found for this signature in database
3 changed files with 33 additions and 16 deletions

View File

@ -1,11 +1,16 @@
FROM docker.io/library/python:3-alpine # syntax=docker/dockerfile:1
ARG BASE_IMAGE=docker.io/library/python:3-alpine
ARG APP_DIR=/hoster
FROM ${BASE_IMAGE}
RUN pip3 install docker RUN pip3 install docker
RUN mkdir /hoster
WORKDIR /hoster ARG APP_DIR=/hoster
ADD hoster.py /hoster/ WORKDIR ${APP_DIR}
ADD hoster.py ./
CMD ["python3", "-u", "hoster.py"] CMD ["python3", "-u", "hoster.py"]
# CMD "whoami"

12
docker-compose.yaml Normal file
View File

@ -0,0 +1,12 @@
# This file replaces `docker build -t docker-hoster .`
# Run this with `docker-compose build`
version: '3.8'
services:
host-hostnames:
container_name: 'host-hostnames'
build:
context: '.'
volumes:
- '/var/run/docker.sock:/tmp/docker.sock:ro'
- '/etc/hosts:/tmp/hosts'

View File

@ -125,7 +125,7 @@ def update_hosts_file():
aux_hosts.writelines(lines) aux_hosts.writelines(lines)
#replace etc/hosts with aux file, making it atomic #replace etc/hosts with aux file, making it atomic
shutil.move(aux_file_path, hosts_path) shutil.copyfile(aux_file_path, hosts_path)
def parse_args(): def parse_args():