Skip to content

Instantly share code, notes, and snippets.

@entone
Created September 4, 2019 20:22
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 entone/b93feffe9c46b0a7d6ea279f22484063 to your computer and use it in GitHub Desktop.
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
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;
}
}
# 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