Created
September 4, 2019 20:22
-
-
Save entone/b93feffe9c46b0a7d6ea279f22484063 to your computer and use it in GitHub Desktop.
Dockerfile for building a separate container for a React frontend in `priv/admin` directory of an Elixir application
This file contains hidden or 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
server { | |
listen 80; | |
server_name localhost; | |
location / { | |
gzip_static on; | |
root /usr/share/nginx/html; | |
try_files $uri /index.html; | |
} | |
location = /50x.html { | |
root /usr/share/nginx/html; | |
} | |
} |
This file contains hidden or 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
# Build step | |
FROM node:12.8 as build | |
WORKDIR /app | |
COPY ./priv/admin . | |
RUN npm install | |
RUN npm run-script build --frozen-lockfile --non-interactive | |
# Release step | |
FROM nginx:1.17.2-alpine | |
COPY ./priv/admin/nginx/default.conf /etc/nginx/conf.d/default.conf | |
COPY --from=build /app/build /usr/share/nginx/html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment