Make `preflight` request pass okay
[asis23-votoe-server.git] / Dockerfile
blobbeb004492e06b527aea65c485fdfffc579aad05c
1 FROM php:8.2.10-cli-alpine3.17
3 # Arguments
5 ARG ARG_LISTEN_HOST="0.0.0.0"
6 ARG ARG_LISTEN_PORT="80"
8 # Environment variables
10 ENV LISTEN_HOST=$ARG_LISTEN_HOST
11 ENV LISTEN_PORT=$ARG_LISTEN_PORT
13 # Install SQLite
14 RUN set -eux \
15     && apk update \
16     && apk add sqlite \
17     && rm -rf /var/cache/apk/*
19 # Copy code into image
20 COPY . "/opt/"
22 # Change working directory
23 WORKDIR "/opt"
25 # Reset database
26 RUN set -eux \
27     && rm -f database.sqlite \
28     && sqlite3 database.sqlite < votar.sql
30 # Expose port
31 EXPOSE $LISTEN_PORT
33 # Run REST API server
34 CMD /usr/local/bin/php -S "${LISTEN_HOST}:${LISTEN_PORT}" rest-api.php